Anecdotally I find swearing makes it worse. Now I just saw "ow!" or "that hurt!" Which honestly feels like it synchronizes my brain past the insult and I can move on much faster past it.
This matches research on pain catastrophizing vs. neutralizing - your approach of acknowledging pain directly without emotional amplification may be activating different neural pathways than those enhanced by taboo-word usage.
Yeah, I never get the compulsion to swear when doing something stupid to myself lol. People have impulse control, but it may be stronger in some than others.
Similar: I say something amusing/funny, e.g. I hit my head on a piece of metal and yelled "ah ya mother was a tin can you metal bastard" which breaks your thought from the pain. Screaming fuuuuuuuuuuuuuuu... only keeps you focused.
In primates there are commonly 3 noises as a reaction to danger.
Initially the work from the 70s-80s on vervet monkeys https://pubmed.ncbi.nlm.nih.gov/7433999/
which was then found to be generalized for a host of other primates
~1 for danger in the air
~1 for danger on the ground
misc for unspecified danger
I would bet that modern swearing maps to these calls in a less specific way. Equivalents of "this shite" "that arsehole" and "damnnit" may have an evolutionary origin.
I use a mix of both, but when I’m in really serious pain, I also find it’s more effective when I’m just like “Wew. WOW. Yeah that’s pretty good there. Phew. Wow. WOOOW.”