Jesus was referring to two Jewish men who were in the Temple. One a religious Pharisee and the other a tax collector for the Roman government. The Pharisee reminded God how faithful he was and the tax collector recognized that he needed mercy from God. There will come a time when even the Pharisees will realize they must depend on the mercy of God rather than their own righteousness (justification)...
"...in Your sight no one living is righteous...As it is written, there is none righteous, no, not one:" (Psalm 143:2; Romans 3:10).
Humans are equal in the sight of God - equally unrighteous! Therefore all are of us are dependent on God's mercy. And it will be provided for everyone.
“It is of the Lord's mercies that we are not consumed, because His compassions fail not. They are new every morning” (Lamentations 3:22-23)
"...God has consigned everyone to disobedience so that He may have mercy on everyone." (Romans 11:32)
"...a man is not being justified by works of law, except alone through the faith of Christ Jesus, we also believe in Christ Jesus that we may be justified by the faith of Christ and not by works of law, seeing that by works of law shall no flesh at all be justified." (Galatians 2:16)
“To him who does not work but believes on Him who justifies the ungodly, His faith is accounted to us for righteousness." (Romans 4:5).
To summarize: ALL humanity are deemed righteous (just) by the faith of Christ Jesus - not by works required by the religious institutions.