Self-righteousness is elevating self rather than the righteousness of God.
And he spake this parable unto certain which trusted in themselves that they were righteous, and despised others: Two men went up into the temple to pray; the one a Pharisee, and the other a publican. The Pharisee stood and prayed thus with himself, God, I thank thee, that I am not as other men are, extortioners, unjust, adulterers, or even as this publican. I fast twice in the week, I give tithes of all that I possess. And the publican, standing afar off, would not lift up so much as his eyes unto heaven, but smote upon his breast, saying, God be merciful to me a sinner. I tell you, this man went down to his house justified rather than the other: for every one that exalteth himself shall be abased; and he that humbleth himself shall be exalted. (Luke 18:9-14 KJV)
Self-righteousness is elevating self in importance rather than man occupying a place of low importance as measured against the righteousness of God. Many today are busy raising their own standing to a higher level than that which is scripturally appropriate when measuring against the plumb line or the perfection of God. God is naturally elevated while mankind is naturally of low estate.
There are many “modern day Pharisees” who view themselves as having already attained sinless perfection while sojourning on this earth. The Bible tells us that it is impossible for the spiritual man to be without sin in this earthly realm; even when in a position of fellowship with God. Those who are humble in the presence of God’s holiness are being honest with themselves and God just as the publican in this passage who saw his natural sin nature choosing to agree with God about sin.
The Bible says:
If we say that we have no sin, we deceive ourselves, and the truth is not in us. (1 John 1:8 KJV)
God views those who have been quickened alive as sanctified, or covered in the blood of Christ, while sojourning upon this earth in fellowship with God on daily basis. Man faces constant battles between desires of his flesh and his new spiritual nature. The spirit which man chooses to feed is the spirit which is in control of his daily walk. God gives mankind everything he needs to live a successful spiritual life as he walks upon this earth but man does make some poor spiritual choices in his fellowship with God.
Final victory over sin comes in the eternal realm in the presence of God. Man will put on his new spiritual body; after leaving behind his tent of flesh in the earthly realm. Then, and only then, will man be sinless, perfect and Godlike.
In whom we have redemption through his blood, the forgiveness of sins, according to the riches of his grace; Wherein he hath abounded toward us in all wisdom and prudence; (Ephesians 1:7-8 KJV)