The Apostle John actually commands believers to not associate with those professing to be believers who deny that Jesus came in the flesh.
For many deceivers have gone out into the world, those who do not
confess the coming of Jesus Christ in the flesh. Such a one is the
deceiver and the antichrist. 8 Watch yourselves, so that you may not
lose what we have worked for, but may win a full reward. 9 Everyone
who goes on ahead and does not abide in the teaching of Christ, does
not have God. Whoever abides in the teaching has both the Father and
the Son. 10 If anyone comes to you and does not bring this teaching,
do not receive him into your house or give him any greeting, 11 for
whoever greets him takes part in his wicked works. 2 John 1:7-11 ESV
Additionally, Jesus Himself taught that there times when believers should disassociate from others who claimed to be believers:
“If your brother sins against you, go and tell him his fault, between
you and him alone. If he listens to you, you have gained your brother.
16 But if he does not listen, take one or two others along with you,
that every charge may be established by the evidence of two or three
witnesses. 17 If he refuses to listen to them, tell it to the church.
And if he refuses to listen even to the church, let him be to you as a
Gentile and a tax collector." Matthew 18:15-17 ESV
For a Jew at that time, there was strict rules about associating with Gentiles (those who did not worship the one true God).
Of course, no one--Christian and non-Christian and even atheist alike--should ever associate with tax collectors. That's a universal moral absolute.
Paul's instructions are directed at a specific case that was occurring in the Corinthian church, so he didn't mention those who deny that Jesus came in the flesh or because that wasn't an issue in the Corinthian church at the time--really bad sexual immorality was.
So, sexual immorality is not singled out in the body of Scripture for disassociation--it's just mentioned because it was occurring in this specific instance.