As an avid triathlete and a person who pays to suffer (aka race) I've tried the self-talk many times. What I found is that it really depends on your state of mind and drives.
Clear Mind. If you have other things on your mind pre-race, they tend to come out at the worst possible time during the race. For example, during my last race I was already stressed out about financials and these thoughts started to creep out toward the end of the race. I tried refocusing with self-talk, but my mind was somewhere else already.
Clear Drive. I found that a cause greater than my own really unlocks extra power and motivation at the hardest moments. It is truly remarkable how your mind can turn that switch on when needed. So having a reason that is clear and inspiring beats any self-talk.
Here a picture from that race: