This happens to many people and isn't necessarily serious.
How often does this occur and how bothersome is it?
If this is happenning and often you should see a doctor right away. I would see both a family doctor (to make sure there is nothing medical going on) and a psychiatrist for a detailed evaluation. You need a comprehensive, face to face evaluation before recommending any solutions. A workbook for OCD might help, but I cant say for sure if this is OCD or something more. See a doctor soon. Take care.
I have seen this type of issue many times and you can get over it. I rarely use the word "cure" in my practice. However, many patients similar to you can get nearly 100% relief of such symptoms. I do not think you need any particular specialist...any good psychiatrist will do just fine. Good luck.