Scrupulosity, OCD, Waswasa Al Qahri In Islam
You have the book of Allah with you. As long as you understand and follow it with honesty ( to the best of your understanding ) then even if your understanding truns out to be wrong on the day of judgement, you’d still have a genuine justification to present on the day of judgement and justice will be done. However, if it is to the contrary then neither will the justification benefit nor will the deeds. This attitude also help with these kind of intrusive thoughts which sometimes affect one’s mental health. This attitude coupled with professional help, can help minimze this problem greatly. If you have any specific question about masturbation, please feel free to post it as a separate discussion.