Luke frames this prayer within a parable explicitly addressed, the Gospel says, to people confident of their own righteousness and contemptuous of others, setting a Pharisee who thanks God he is not like other sinful people, listing his own fasting and tithing, directly against a tax collector who stands at a distance, will not even lift his eyes to heaven, and says only a plea for mercy on a sinner.
First-century audiences would have recognized the social charge in this pairing immediately: Pharisees were widely respected for religious observance, while tax collectors, working for the occupying Roman authority and often suspected of extortion, were among the most socially despised figures in Jewish Galilee and Judea, which made Jesus's verdict, that the tax collector rather than the Pharisee went home justified, a genuinely startling reversal rather than a comfortable moral lesson. The parable's closing statement, that whoever exalts themselves will be humbled and whoever humbles themselves will be exalted, recurs elsewhere in the Gospels attached to different sayings, suggesting it functioned as a kind of stock proverbial conclusion Jesus applied to more than one teaching about status and humility.