There is a judging wrongly and a judging rightly.
Do not judge by appearances, but judge with right judgment.”
John 7:24 ESV
https://bible.com/bible/59/jhn.7.24.ESV
And we are encouraged to bring each other back from wandering away from God:
My dear brothers and sisters, if someone among you wanders away from the truth and is brought back, you can be sure that whoever brings the sinner back from wandering will save that person from death and bring about the forgiveness of many sins.
James 5:19-20 NLT
https://bible.com/bible/116/jas.5.19-20.NLT
We are called to be discerning about those who claim to be believers:
I meant that you are not to associate with anyone who claims to be a believer yet indulges in sexual sin, or is greedy, or worships idols, or is abusive, or is a drunkard, or cheats people. Don’t even eat with such people. It isn’t my responsibility to judge outsiders, but it certainly is your responsibility to judge those inside the church who are sinning. God will judge those on the outside; but as the Scriptures say, “You must remove the evil person from among you.”
1 Corinthians 5:11-13 NLT
https://bible.com/bible/116/1co.5.11-13.NLT
Because not everyone who makes such a claim with their words actually knows, loves, and serves God:
‘These people honor me with their lips, but their hearts are far from me. Their worship is a farce, for they teach man-made ideas as commands from God.’ ”
Matthew 15:8-9 NLT
https://bible.com/bible/116/mat.15.8-9.NLT
We are to learn to discern rightly, learn to rightly apply the Word of God, and for good purpose:
Don’t you realize that someday we believers will judge the world? And since you are going to judge the world, can’t you decide even these little things among yourselves? Don’t you realize that we will judge angels? So you should surely be able to resolve ordinary disputes in this life. If you have legal disputes about such matters, why go to outside judges who are not respected by the church? I am saying this to shame you. Isn’t there anyone in all the church who is wise enough to decide these issues?
1 Corinthians 6:2-5 NLT
https://bible.com/bible/116/1co.6.2-5.NLT