Sounds like you have obsessive thinking. You can break that pattern by distracting yourself with something like exercise. Or, as was suggested to me, placing an elastic band (large enough that it doesn't cut of circulation) around your wrist and every time you have an obsessive thought to pull on the elastic with your free hand and snap it against the skin of your wrist.
There's probably less wrong with you than you think, but it's the over-thinking and obsessing that has become very problematic.
Here's a video about a doctor who also has obsessive and intrusive thoughts. You are not alone.