This is a question many Christians ask that usually turn down their faith whenever they want to communicate with God. Once you close your eyes to pray, you see flash back of scenes where you indulged in sin.
Let me let you know, our God is a merciful God, a very kind and graceful One which His mercies ends on the judgement day where He recieves no excuse from anyone about their sins. Jesus came down on earth to make an eternal sacrifice with His precious blood which formally in the Old Testaments was done with the blood of cow, bulls and other animals and is only done by Priest whenever you want to get your sins forgiven.
The death of Jesus tore the veil between God and man which made it available to speak and hear from God by any man, not only priests and also made it available to confess your sins and get forgiven, read Hebrews 10
I say this and will always say it “the devil is a liar and very tricky”, once you ask for forgiveness fully from your heart your sins are forgiven. You are now pure and holy, the devil doesn’t know any other way to get you rather he tries to block your communication with God by giving you flash backs of your already forgiven and forgotten sins and this will turn down your faith and spoil the prayer you were about to enter. Just bear it in mind your sins are already forgiven and continue your prayers 🙂
Reading this passage assured me that once we confess our sins to God it is forgiven and lets not go back to it again! (Hebrews 10:17). So resist the devil and he will flee, announce to him that your sins are already forgiven and you are a new being now.