Matthew 7:1-6 warns against the rush to judgement. Given that Jesus himself does make judgements, gives the keys of the kingdom to the disciples and encourages church discipline, it seems unlikely that this is a blanket ban on exercising justice or discernment. However, what we have seen throughout the Sermon on the Mount is that Christ is concerned with our hear attitudes and so quite rightly, preachers have observed that this passage is really about judgementalism.
The first thing to notice about what Jesus says is that he tells us to watch out for two types of people before rushing into a judgement. The first is those making the judgement and the second is those receiving the judgement.
Before we judge, we need to check our own fitness to judge. Just as you don’t want someone trying to do eye surgery on you when their own eyes are a mess, so you don’t want to be making judgements about others when your own judgement is clearly impaired. That needs to get sorted out first.
On the other hand, there is no point attempting to offer advise and judgement to those who are simply not in a position to hear your discernment, referred to as pigs and dogs here. You risk arousing their anger against yourself and coming to harm.
So, first of all, we need to make sure that we have the capacity to rightly assess the situation and secondly we need to ensure that the other person is in a position where they can hear rightly.