Two very distinct ideas comprise this chapter. They connect by the understanding that the judgment of God falls on the sexually immoral. Judge among yourselves and don't go before a court. God will judge and he will exclude certain sinners (1 Cor. 6:9-11), you can be sure. So, don't be that kind of sinner.
His rationale for avoiding court and settling your own disputes is interesting, to say the least. Saints will judge the world and saints will judge the angels. Apparently, Paul knows more than he tells. I have no idea what this means exactly. If you take an offense against a brother to a human court you are appealing to an inferior court!
Like bread is for the stomach, so the Lord is for the body. God does not intend a spiritual relationship with us only. He wants us physically to be wholly his, too. Our bodies have been purchased to be his temples.