First, here's an example of what "judging" is and is not:
When a long-married pastor at a "mega-church" was discovered to have had an ongoing homosexual affair with a male prostitute, some members of his congregation immediately jumped to his defense by proclaiming: "You shouldn't judge him! You don't know his heart. He just made a mistake," etc. This is a total misinterpretation of the passages about "judging"!
First of all, a "mistake" is accidentally doing or miscalculating something. A "mistake" is doing or saying something you didn't realize might end up affecting you or someone else in a negative way. Having an ongoing homosexual affair when you KNOW what Scripture says - well, that is NOT a "mistake"! The pastor not only defied YHWH by doing something He considers "an abomination"; but he also committed adultery against his wife - which is another sin YHWH frowns upon.
The truth is, Believers MUST keep each other in line, so to speak. If we see a fellow believer deliberately sinning, we cannot simply "turn a blind eye"; we are obligated to help him/her back onto God's path. At the same time, we cannot add to what Torah says....
James 4: 11. Speak not against each other, my Brothers; for he that speaks against his brother, or judges his brother speaks against Torah and judges Torah. And if you judge Torah, you are not a doer of Torah, but its judge. 12. There is one Torah-giver and Judge who can make alive and (can) destroy: but who are you that you judge your neighbor? (AENT)
(1) If you add your own judgments to those already established in the Torah of YHWH, then you have judged Torah as insufficient, and are not allowing it to be your judge.
(2) One Torah Giver who gives One Torah. The halacha (way to observe Torah) is revealed by the Ruach haKodesh, and demonstrated in Mashiyach. The concept of "two torahs" one oral and one written is the basis of authority on which the Rabbinate operates. "The Rabbis" wrote their own "oral Torah" and give themselves the authority to interpret it; unfortunately, their oral Torah often speaks against both the Written Torah and haMashiyach.
On the other hand, Christian theologians have made up their own "New Testament" based on their own non-Torah cultural value systems which makes void Torah and diminishes the true goal of Mashiyach.
We would be "judging" this pastor if we were to slander him by suggesting, for instance, "Well, he probably had lots of affairs before this and he'll never change, because that's just how he's wired. He's homosexual, through and though and God will NEVER forgive that!"....WE do not have the right to make those types of statements! We don't know for sure that the pastor "won't change." Knowing what people will or won't or are likely to do is YHWH's job; not yours!
It would NOT be "judging" to tell this pastor biblically how and why he sinned; or telling him with conviction that he needs to repent and totally turn from that sin, or else his soul will be in jeopardy! There's nothing wrong with showing him the scriptures that reveal there is no sin sacrifice for continued, deliberate sinning. Once you know what you've done is a SIN, you must stop! YHWH/God knows our hearts; He knows who is serious about doing HIS will, and who is being "lukewarm." And He and only He is able to determine where we each get to spend eternity.
If you have done your job and tried to help a brother or sister back onto YHWH's Path, but they refuse to repent and turn from their ways, then all you can do is "turn them over to God" and shake the dust from your sandals. Do not hang out with, or condone the sin, or else you will be guilty of aiding a sinner.
As the old adage goes, "Don't give a drunk a drink. Don't give a Heroin addict money to buy more drugs." We can add to that, "Don't help an adulterer commit adultery by 'playing nice' and refusing to get involved"....GET involved, and if it looks like they aren't going to listen to scriptural advice, stay away from them. Scripture commands us to stay away from evil.