We like to point out scripture that assures us that God will hear (and answer) our prayers. We like to remember God’s promises of blessing and peace and grace. And we tend to ignore or forget that there are some prayers that God has said He will not hear or answer.
God will not answer prayers that are selfish, or hypocritical. He will not answer prayers offered in pride, self-righteousness, or unbelief (see Luke 18:9-14, and Hebrews 11:6). He will not listen to prayers offered by those who oppress the poor, those who worship idols, or those who practice violence. And He will not listen to the prayers of those who reject Him, and remain in sin. https://www.gty.org/library/questions/QA160/does-god-answer-the-prayers-of-unbelievers (Please note: I don’t totally agree with the general conclusion here, but there are several great references for the individual points..)
Please note that God does not say that He will not answer prayer based on WHO a person is–God does not refuse to answer prayers based on a person’s age, nationality, gender, physical health, mental health, height, weight, social status, or any other label, including their past religious affiliation! This means that a sincere prayer of a person who is seeking God may be heard ahead of (or instead of) a prideful prayer of someone who claims to be a Christ-follower.
God is sovereign and omniscient– He knows what is in each heart, and He answers, not according to who we are, but according to who HE is. And just as He can separate our sins “as far as the east is from the west” (Psalm 103:12), and “remember (our) sins no more”(Hebrews 8:12), He can choose not to hear prayers that are offered with wrong motives or offered in defiance of His sovereignty and holiness.
None of this takes away from the fact that God DOES hear and answer prayer…God LOVES to hear from anyone and everyone who seeks His face. Nothing external can separate you from His love. Come with your anger, questions, sorrows, pains, gratitude, hope; bring your failures, your fears, and your triumphs. But God, like a wise father, doesn’t suffer fools and fakers. Even if you can fool your neighbors, friends, family, or yourself, you cannot fool God. He doesn’t want a false narrative– He wants you as you really are. And He will listen with an everlasting love and compassion to all such prayers!