(FOR CHRISTIANS) Does anyone else have it where they get a thought "if you dont do X a certain number of times, Y (punishment, or something bad that I don't want to occur) will happen? Is it God?

Sometime I need to convince the voice to not punish me by praying a specific prayer. Is this God? Ive had it since I was a child. It scares me and the punishment can be anything, sometimes something completely unrelated. Typically the thing I need to do is repeat something, like an action, or something I just said.