STOP worrying about , your body, your swing and what you should be doing next. Just focus on where you want the ball to go. STOP trying to fix problems during the game. Time at the range is for sorting out problems and working on specific areas. When you are playing your focus should not be on the problems it should be on playing your best.
Games are for performing the range is for practice.
Know the points in your game where you lose focus. They can be as simple as the hole you never play well, the part of your game that doesn't work, the group you feel uncomfortable with, the course you don't know or even what you will be doing after the game. These distractions have nothing to do with your game, however you will be distracted by these things. Thinking about the distraction will not help your game , it will limit your game and continue to be a total waste of time. If you can see patterns in your game, if your game is stuck and you are not getting the results that you want, changing your results can be easy.