I have done that and it's a part of my personality that I hate. I know it is rooted in pride (sin) and self-righteousness (again, sin) and a lack of sympathy (more sin).
The moment I feel that urge to be judgmental, I've sort of trained myself to pause first before speaking.
Then I tell myself words similar to those first two sentences. And I tell myself that whatever I do could be this person's first and last time seeing a Christian in action.
Most of all, I remind myself every chance I get that if not for God's grace, I would be most wicked and wretched. The ability to say no to a sin is not my will, but His gift. How dare I dishonor such a privilege?
My grandmother once told me, "When given the choice between being right or being kind, always choose kind." She'll be 95 soon.