Have you ever got sucked into a trap of obsessively thinking and worrying about the same problem? It exhausts our time and energy, whilst being unlikely to lead to helpful new insights. Furthermore, if our minds spend longer dwelling on negative things then this can lead to us attaching greater weight to them over positive things.
It is something that can happen to anyone, but other times it is part of a mental health condition such as GAD (Generalised Anxiety Disorder) or OCD (Obsessive Compulsive Disorder). This advice is targeted at dealing with the obsessive thinking and not any underlying conditions.
First of all, try to be aware of your thinking and identify when your thoughts get stuck in an obsessive loop. It’s almost impossible to rectify something unless you are aware of it to start with.
If you are trying to solve a problem then accept that there is rarely a perfect solution. I make a rule with myself that if no new information comes to light then there is nothing to be gained from revisiting the problem. If you are dwelling on a negative situation you have no control over, try to accept that it is what it is and cannot be changed.
Intentionally shift your focus to something more positive. This could be picking out something specific like planning a holiday or recalling a happy memory you are grateful for. Alternatively consider engaging in mindfulness, the act of focussing on the present moment. There is lots of great advice about mindfulness available on the web.