Become an informed Catholic. Click here to join the fight.
There are two types of judging. One is a sin, and the other is required by God. The first type is attempting to judge a sinner's subjective moral culpability, which God alone can know. This is a sin as only God can see the degree of malice with which a sin was committed. The second type is simply judging the objective sin itself as being in violation of the Ten Commandments. God requires each person to discern good from evil, so they may do good and avoid evil.
Simply pointing out the fact that a sinner has materially broken one of the Ten Commandments is not forbidden. It's actually part of the spiritual work of mercy called admonishing the sinner. In 2 Timothy 4:1–2, St. Paul taught:
I charge thee, in the sight of God and Christ Jesus, who will judge the living and the dead ... preach the word, be urgent in season, out of season; reprove, entreat, rebuke with all patience and teaching.
This can only be done by first judging what is a sin so that the sinner may be corrected.
Condemning one's neighbor as being irredeemable is a type of judging that's forbidden but charitably correcting them is not. Our Lord directs in Matthew 18:15–16:
If your brother sins against you, go and show him his fault, between you and him alone. If he listens to you, you have won your brother. But if he doesn't listen to you, take with you one or two more so that on the word of two or three witnesses every word may be confirmed.
In the Sermon on the Mount Jesus exhorted in Matthew 7:1, "Do not judge, that you may not be judged." The Church Fathers explain here that Christ is warning against having a hypocritical blindness to one's own faults while pointing out the moral faults of others. They note, too, that Christ is also warning against rashly judging others in an unfavorable light and with an air of moral superiority.
See how God's judgment will be based on one's conscience in season one of Church Militant's Premium show, Moral Compass—Conscience.