Luke 18:9-14.
Jesus told a parable for those who were confident of their own righteousness and looked down other people.
A Pharisee and a tax collector were praying at the temple. The Pharisee prayed and thanked God, saying that he was a right person, was not a sinner, and was doing right things for God. The tax collector prayed to beg the forgiveness recognising he was a sinner.
Jesus said that it was not the Pharisee, but it was this tax collector who was justified before God.