Now for people acquainted with the writings of the apostle Paul, this verse comes across rather shockingly. previously Paul had written about the grace of God and was very clear in his other letters that man is not saved by works but of grace.
Galatians 2:16 knowing that a man is not justified by the works of the law, but by the faith of Jesus Christ, even we have believed in Jesus Christ, that we might be justified by the faith of Christ, and not by the works of the law: for by the works of the law shall no flesh be justified.
So what do we do with a seeming paradox? The key as is often the case is in the context!
6 Dare any of you, having a matter against another, go to law before the unjust, and not before the saints? 2 Do ye not know that the saints shall judge the world? and if the world shall be judged by you, are ye unworthy to judge the smallest matters? 3 Know ye not that we shall judge angels? how much more things that pertain to this life? 4 If then ye have judgments of things pertaining to this life, set them to judge who are least esteemed in the church. 5 I speak to your shame. Is it so, that there is not a wise man among you? no, not one that shall be able to judge between his brethren? 6 But brother goeth to law with brother, and that before the unbelievers. 7 Now therefore there is utterly a fault among you, because ye go to law one with another. Why do ye not rather take wrong? why do ye not rather suffer yourselves to be defrauded? 8 Nay, ye do wrong, and defraud, and that your brethren. 9 Know ye not that the unrighteous shall not inherit the kingdom of God? Be not deceived: neither fornicators, nor idolaters, nor adulterers, nor effeminate, nor abusers of themselves with mankind, 10 nor thieves, nor covetous, nor drunkards, nor revilers, nor extortioners, shall inherit the kingdom of God.11 And such were some of you: but ye are washed, but ye are sanctified, but ye are justified in the name of the Lord Jesus, and by the Spirit of our God.12 All things are lawful unto me, but all things are not expedient: all things are lawful for me, but I will not be brought under the power of any. 13 Meats for the belly, and the belly for meats: but God shall destroy both it and them. Now the body is not for fornication, but for the Lord; and the Lord for the body. 14 And God hath both raised up the Lord, and will also raise up us by his own power. 15 Know ye not that your bodies are the members of Christ? shall I then take the members of Christ, and make them the members of an harlot? God forbid. 16 What? know ye not that he which is joined to an harlot is one body? for two, saith he, shall be one flesh. 17 But he that is joined unto the Lord is one spirit. 18 Flee fornication. Every sin that a man doeth is without the body; but he that committeth fornication sinneth against his own body. 19 What? know ye not that your body is the temple of the Holy Ghost which is in you, which ye have of God, and ye are not your own? 20 For ye are bought with a price: therefore glorify God in your body, and in your spirit, which are God’s.
1 Corinthians 6:1 Dare any of you, having a matter against another, go to law before the unjust, and not before the saints?
Now "unjust" is synonymous with unrighteous. As shown below..