You are not serving on a jury to condemn a person, you are serving to help determine if a crime was committed by them with the certainty being beyond a reasonable doubt.
Without the court system, victims would have no defense, and oppressors would run rampant.
Remember there's a whole book of the Bible about the judges God put in place.
Some other verses for balance:
Lu 12:57
And why do you not even on your own initiative judge what is right?
Le 19:15
You shall do no injustice in judgment; you shall not be partial to the poor nor defer to the great, but you are to judge your neighbor fairly.
Mt 5:25
Make friends quickly with your opponent at law while you are with him on the way, so that your opponent may not hand you over to the judge, and the judge to the officer, and you be thrown into prison.
Joh 7:24
Do not judge according to appearance, but judge with righteous judgment.
Joh 7:51
"Our Law does not judge a man unless it first hears from him and knows what he is doing, does it?"
Surrounding the two verses you're talking about, Jesus is teaching His disciples many principles of life that give better results than gut instinct ones would. Jesus speaks of generosity when being taken advantage of.
Mt 7:1
Lu 6:37
"Do not
judge, and you will not be judged; and do not condemn, and you will not be condemned; pardon, and you will be pardoned. Give, and it will be given to you. For by your standard of measure it will be measured to you in return.
Even though Jesus challenges Old Testament ideals, He does not tell them to throw out the original law, which God commanded to follow from generation to generation.
Mt 5:17
"Do not think that I came to abolish the Law or the Prophets; I did not come to abolish but to fulfill.
The heart of the law is protection of the innocent, and justice when one person wrongs another. It is a valuable practice in any society, and allows people to live in safety.