On "Do not judge, or you too will be judged" (Mt 7.1-5), Eric Bargerhuff writes in The Most Misused Verses in the Bible:
What this means is that the greater judgment is reserved for the one who has purposefully overlooked his own mammoth sin while pointing out the smaller sins of others. Jesus emphatically says this must change, so he gives two commands: Stop judging others in a hypocritical fashion, and get the sin out of your own life.
Yet let’s be clear. Jesus is not suggesting that we have no right to make moral judgments about human behavior, and he is certainly not suggesting we have no right to hold others accountable. He doesn’t condemn mutual accountability and moral responsibility and the need to address sin in the church— he addresses hypocrisy.
The truth of the matter is we should all be grieved about sin in our lives. And when we see it, we should address it, confessing it and forsaking it out of reverence for God. It is only when we are consistently doing this ourselves that we are qualified and able to address the sins in the lives of our brothers and sisters in the church, which we must do as well.
The Bible makes it clear that it is our duty to spur one another on to live lives that please God. First, our lives should give evidence that we have truly repented of our sin and received Christ by faith. Then from time to time, as necessary, we are also called to mutually correct, rebuke, and encourage one another in love.
Jesus does not forbid all moral judgment or accountability. Rather, he forbids harsh, prideful, and hypocritical judgment that condemns others outright without first evaluating one’s own spiritual condition and commitment to forsake sin.