The Gospel of Luke, 18:9-14, provides a wonderful parable illustration from Jesus concerning those (peitho - to persuade, to argue a point, to convince, to believe) who are convinced that they are in right relationship with God and view others with disdain.
To be "righteous" (for a Bible Believing Jew) is to be in proper relationship with God. It does not mean those who think they have earned salvation or those who think they are perfect. Righteousness has to do with our standing with God. The twin components (faith and fidelity, trust and loyalty) are always in play. To be saved by faith meant to trust God, to entrust oneself to God and to be trustworthy (obedient to Torah). Jesus (and Paul) teaches the same thing (though now relationship to Jesus factors into how one trusts God and how one is loyal/obedient). While we might be tempted today to see this parable as a harsh judgment on "self-righteous people" (or works righteousness) I think we ignore the second descriptor (viewing others as naught) at our own risk. The Lord identifies both as the problem. Those who believe they are saved while negating the salvation of others are invited to listen. Notice the actual wording the first man uses.
So what is Jesus' point? He illustrates it rather clearly. Two guys go to pray. One says, "Thanks God that I am not like the rest of humanity. I fast and tithe." Who is this guy? Sadly, he is identified as a Pharisee, so many of us see it as a problem for others. While Jesus may well have identified the man as a Pharisee, He is not saying this is what all Pharisees are like, and more importantly, He is not saying only Pharisees are like this! The point is the attitude. Thank you that I am not like "them" is not limited to Pharisees. Too often Christians embrace this mindset as they pray (I'm not a Muslim, a Hindu, and I have even heard a Catholic!). The man is an example of us all.
Right relationship with God is described by Jesus as Love. Love God with all you are and love your neighbor as yourself He famously said, and you will have eternal life. How does that translate into flesh and blood? Well, true love is a complex thing, but clearly it does not include thanking God that you are not like all the dregs of the world. Clearly, Jesus never did that (HE said He came to save the sick and lost, not talk bad about them). Love means seeking the best for others, loving them without limits---forgiving, healing and rescuing them from the demonic, the world and from themselves. The Pharisee's problem was he was so jazzed up about being "the elect" that he stopped seeing the humanity of others---calling them thieves, rogues, adulterers. It is easy to dehumanize others, to look down upon them and hold them as naught. It is especially easy to do this about alien religions. And while I believe there is no salvation outside of Jesus, I do not know that I can agree with how that is translated by any number of other Jesus Believers. I think we may not be Pharisees, but we all have moments where we pray like the one in the parable.
The second man, a tax collector, just stood there repenting. Over and over crying for mercy. Jesus said that this second man went home in right relationship (justified) with God. Once again, the point is that when we come before God we must know our place. We are the recipients of grace, the free gift of God's favor, mercy and love. We do not earn it by our actions, and we certainly don't deserve it because we answered a salvation quiz correctly! It is because God is gracious and kind and we don't need to ever forget that. Our sin awareness keeps us in a right frame of mind in approaching God.
I am blessed with a high capacity for guilt so praying "Lord have mercy on me a sinner" comes easily. Even so, I also know that I have my own tendencies toward marginalizing others. I have my own list of folks whom I thank God I am not like. As I get older, that list has gotten smaller, but today I pause to reflect on the fact that there is anyone on the list at all. Yet another reason to say "Lord be merciful to me, a sinner."
Thank you God for your mercy and loving kindness. That is the proper focus: God. Not on me and my comparative superior place in the human race, but on the Creator who loves us all, even the ones who are headed in the wrong direction.
Jesus warns us, your attitude toward others impacts your relationship with God. Pray accordingly!