Some individuals are more distracted by pain during a cognitive task than others, representing poor pain coping. We have characterized individuals as A-type (attention dominates) or P-type (pain dominates) based on how pain interferes with task speed. The ability to optimize behavior during pain may relate to the flexibility in communication at rest between the dorsolateral prefrontal cortex (DLPFC) of the executive control network, and the anterior mid-cingulate cortex (aMCC) of the salience network (SN) – regions involved in cognitive-interference. The aMCC and aIns (SN hub) also signify pain salience; flexible communication at rest between them possibly allowing prioritizing task performance during pain. We tested the hypotheses that pain-induced changes in task performance are related to resting-state dynamic functional connectivity (dFC) between these region pairs (DLPFC-aMCC; aMCC-aIns). We found that 1) pain reduces task consistency/speed in P-type individuals, but enhances performance in A-type individuals, 2) task consistency is related to the FC dynamics within DLPFC-aMCC and aMCC-aIns pairs, 3) brain-behavior relationships are driven by dFC within the slow-5 (0.01–0.027 Hz) frequency band, and 4) dFC across the brain decreases at higher frequencies. Our findings point to neural communication dynamics at rest as being associated with prioritizing task performance over pain.