There’s a famous story told in chassidic literature that addresses this very question.
The master teaches the students that God created everything in the world to be appreciated since everything is here to teach us a lesson. One clever student asks “What lesson can we learn from the atheists? Why did God create them?”
The master responds “God created the atheists to teach us the most important lesson of them all – the lesson of true compassion. You see, when an atheist performs an act of charity, visits someone who is sick, helps someone in need, and cares for the world, he is not doing so because of some religious teaching. He does not believe that God commanded him to perform this act. In fact he does not believe in God at all, so his actions are based on his inner sense of morality. And look at the kindness he could bestow upon others simply because he feels it to be right.”
This means, the master continued, that when someone reaches out to you for help, you should never say “I’ll pray that God will help you.” Instead, for that moment you should become an atheist, imagine there is no God who could help, and say “I will help you.”
If there is redemption in religion, I believe it comes when religious people understand this story.
Source: My memory hearing this story countless times in my youth. Chassidic stories are typically transmitted orally, and at times you’ll find the same story attributed to different sources. The classic collection Tales of the Hasidim Volume 2 by Martin Buber (Schocken Press, 1958) has a condensed version of this story (titled “When is it good to deny the existence of God”) attributed to Rabbi Moshe Leib of Sasov, the late 18th century student of Rabbi Shmelke of Nikolsburg and teacher of Rabbi Mendel of Kosov. Other versions of this classic tale are probably found in many anthologies of chassidic tales.