One sub-category of OCD is Scrupulosity. The theme of obsessions in scrupulosity relate to religious perfection, moral 'correctness' or pleasing a divine authority. While it may be experienced by religiously observant people it is not limited to religion.
Being preoccupied with being 'correct', 'god-fearing' or 'a morally good person' can lead to repetitive behaviors, reassurance seeking, and extremely rigid 'rules'. Ironically, this behavior will oftentimes prevent an individual from fully engaging in the spiritual pursuits they so value.