“Do not judge, or you too will be judged. 2 For in the same way you judge others, you will be judged, and with the measure you use, it will be measured to you.” Matthew 7:1-2
Have you ever judged someone? I haven’t. Just kidding. But God calls me not to walk in that. He goes on to say in verse 3, “Why do you look at the speck of sawdust in your brother’s eye and pay no attention to the plank in your own eye?”. This is Jesus speaking.
If find myself judging and condemning someone in my heart, I may very well be spiritually worse off than the person I’m judging. Jesus speaks of there being a “plank” in my eye. At this moment I must clothe myself with humility and repent. Its the only reasonable thing to do in the midst of judging others.
Is there a righteous judgement? Yes, this is very different from the judgement Jesus is talking about here and the distinction can generally be made by examining the level of humility, mercy and love in ones heart. You can learn more about righteous judgment here. https://www.gotquestions.org/judge-with-righteous-judgment.html