So why doesn't God answer all our prayers?
The purpose of prayer isn't primarily or only about getting stuff we need or want. If it was, we could say prayer doesn't always work. But prayer DOES always work. It's just that the purpose of prayer is more than just asking for things.
1 Thessalonians 5:16-18
Rejoice always, pray continually, give thanks in all circumstances; for this is God’s will for you in Christ Jesus.
Prayer isn't like a vending machine. Prayer is to help us in a relationship with God. Prayer is how we talk to him.
Just as when a child asks their parent for something, when we do ask God for things, he can answer in one of three ways: YES, NO or LATER. So in this sense, God always answers prayer. It's just that sometimes he says 'no' and sometimes he says 'later'.
Sometimes the reason people don't feel close to God is because they're not! If a person hasn't given their sin to Jesus and asked him to forgive them yet, this is probably the reason it might feel like their prayers aren't getting through.
But your iniquities have separated you from your God; your sins have hidden his face from you, so that he will not hear.
In contrast, the Bible says those who trust and follow Jesus can pray confidently, knowing there's nothing that needs to separate them from God's love any more.
Let us then approach God’s throne of grace with confidence, so that we may receive mercy and find grace to help us in our time of need.
I hope this helps a little. There's lots more God wants to say in the Bible about prayer. Hit the link below...
More on prayer in the Bible