It generally depends on where I am but I tend to do one or more of the following (not necessarily in the given order):
- pause, take some deep breaths
- look outside or at least not at any screens
- drink water or get/make a hot chocolate (or rarely tea)
- do something else which doesn't depend or is related to what I'm coding (e.g: play with a twisty puzzle, play a phone game)
- go on a walk
- try to clear my mind and think about the problem, the solution I'm implementing, a bigger picture, alternative solutions (which may or may not be those I found after searching online)
- stretch
- go to sleep
- save/capture the progress, problems and viable solutions then work on something else.