We are not perfect, and so often our judgement is faulty. Judging though, in itself is not forbidden.
1. The context - previous chapter - Lord's prayer - we must forgive, rather than condemn. Condemnation is usually a sign of self-righteousness. Jesus says we are not to pull others down to build ourselves up. We must always in any correction seek to build them up.
2. We need to be wise about our own sin, and take corrective action. (get the speck in our eye out). We can get complacent about our own sin. Also, being conscious of our own sin can save us from being cruelly judgemental and unsympathetic.
3. Don't give treat the Gospel of no value by ignoring our own sin.