It is crucial that we understand the words “judge” and “judged” here. The word translated “to judge” has a range of meanings: to discern, to judge judicially, to be judgmental, to condemn (judicially or otherwise). To understand which of these apply here, we need to look at the context of the passage where it is used. It means here in this place to have a critical spirit, harping criticism, a condemning attitude. It is the same meaning as in Romans 14:10-13  Why do you pass judgment on your brother? Or you, why do you despise your brother? For we will all stand before the judgment seat of God;  for it is written, “As I live, says the Lord, every knee shall bow to me, and every tongue shall confess to God.”  So then each of us will give an account of himself to God.  Therefore let us not pass judgment on one another any longer, but rather decide never to put a stumbling block or hindrance in the way of a brother. (ESV)
We do have to exercise discernment, to exercise right judgment, to discern that some are false preachers due to their fruit, according to Matthew 7.16.
Where our difficulty lies is in keeping from crossing the line from legitimate assessment to destructive critique. It revolves around the question of our heart attitude. We can tell the truth about someone but do so wrongly and with the wrong attitude of heart. We do have Matthew 18 and other passages to help guide us in how to go about dealing with our brethren in a right way. If we have the right attitude, the right spirit, then the Lord will help us – there I am in the midst of them! Matthew 18.15ff. We will not ignore open sin in one of our Christian brothers or sisters, but will try to restore him—gently, and aware of our own weakness (Galatians 6.1).
The theological justification is found in verse 2  For with the judgment you pronounce you will be judged, and with the measure you use it will be measured to you.
If we are critical / judgmental / condemnatory – all with the wrong attitude, then we also will be judged!
Some commentators note that it was customary to use the same weights and measures in grain sales and then in weighing out the silver for payment. If you use a crooked, rigged standard in measuring out the grain, then you will be paid the price in the weight of silver according to that same crooked standard.
It is another way of our saying, “What goes around, comes around.”
When you pass judgment on others, Chrysostom, the great early Christian preacher said, “you are making the judgment-seat dreadful to yourself, and the account strict.” Francis Shaeffer is reported to have said that God would need to do nothing more to condemn us all a thousand times over than simply to hang a tape recorder around our necks and then hold us to the same standard according to which we had condemned others.
The point is that we should abolish our critical spirit / judgmental attitudes lest we ourselves stand utterly condemned by God. A heart that hasn’t been shown grace isn’t going to show grace towards others, and if we have a critical, carping attitude towards others, then it may well be an indicator that we haven’t experienced grace ourselves in the first place. A heart that has been shown grace by God will show grace – imperfectly, yes, but it will show it. In Matthew 5.6 we are told “blessed are the merciful, for they will be shown mercy,” and, “for if you forgive men when they sin against you, your heavenly father will also forgive you, but if you do not forgive men their sins, your father will not forgive your sins, for in the same way you judge others, you will be judged.” We aren’t earning mercy from God. We are called to reflect that mercy has been shown to us.