In Luke 18:9 we read: "He also told this parable to some people who trusted in themselves that they were righteous."
There is a righteousness of faith, which is a gift from God. And there is a righteousness which we can produce ourselves. The way to find out which one you have is to ask yourself whether you are proud of your righteousness. If so, then you must have produced it yourself. If you had the righteousness of God which was received as a gift from Him, you would be thankful for it, but you could not be proud of it. Pharisees have a righteousness that they are proud of.
You can be proud of a book that you wrote, but you cannot be proud of a book that someone else wrote. So if you are proud of some good quality you have in your life - whether humility, or generosity, or prayerfulness, or whatever it is, you must have produced it yourself. If you are generous and hospitable, and you are proud of it, then those qualities may be just human qualities, and not the divine nature, because if they were part of God's nature that He had given you freely, how could you boast about them? To be hospitable is a good virtue, but if you are proud of it, then your hospitality stinks before God.
This principle applies to other areas too - that have nothing to do with righteousness. Maybe you can sing better than others, or play an instrument better, or preach better, or perhaps your church is larger than someone else's church. Anything that you are proud of is the result of your own labour. If it was God's work, you could not boast about it.
Many boast about the sacrifices they have made for the Lord. That makes it obvious that they have not seen the immensity of Jesus' sacrifice on the cross for them. Can you see a single star when the sun is shining? No. When the sacrifice of Jesus on Calvary becomes as bright as the sun in our minds, all our petty sacrifices will disappear like the stars in the daytime - and we won't even call them "sacrifices" any more. If you can remember all your sacrifices, then you must be in the darkness still - for it is only at night that we can see the stars!!
Come in faith and humility and receive the righteousness of God that he offers you in Christ - and give Him all the glory for it, all the days of your life. Then you will never be a Pharisee.