The topic of separation is one that can be seen from different angles. Is it separation from evil to holiness? Or separation from good to evil, even things separated to destruction. Separation in itself is something that, literally, cuts both ways depending on the context.
Separation from the world
A famous passage from Paul is 2 Corinthians 6:14 “what fellowship has light with darkness?”
14 Do not be unequally yoked with unbelievers. For what partnership has righteousness with lawlessness? Or what fellowship has light with darkness? 15 What accord has Christ with Belial? Or what portion does a believer share with an unbeliever? 16 What agreement has the temple of God with idols? For we are the temple of the living God; as God said, “I will make my dwelling among them and walk among them, and I will be their God, and they shall be my people. 17 Therefore go out from their midst, and be separate from them, says the Lord, and touch no unclean thing; then I will welcome you, 18 and I will be a father to you, and you shall be sons and daughters to me, says the Lord Almighty.” (2 Corinthians 6 ESV)
This teaches that believer should remove him or herself from some situations. However Jesus did not advocate that Christian become a hermit or recluse:
14 I have given them your word, and the world has hated them because they are not of the world, just as I am not of the world. 15 I do not ask that you take them out of the world, but that you keep them from the evil one. (John 14 ESV)
Being on the receiving end of separation
Ironically, Jesus also predicts that men will exclude believers:
22 “Blessed are you when people hate you and when they exclude you and revile you and spurn your name as evil, on account of the Son of Man! 23 Rejoice in that day, and leap for joy, for behold, your reward is great in heaven; for so their fathers did to the prophets. (Luke 6 ESV)
Separation from immorality in the church
A further context is separation within the church:
6 Your boasting is not good. Do you not know that a little leaven leavens the whole lump? 7 Cleanse out the old leaven that you may be a new lump, as you really are unleavened. For Christ, our Passover lamb, has been sacrificed. 8 Let us therefore celebrate the festival, not with the old leaven, the leaven of malice and evil, but with the unleavened bread of sincerity and truth. 9 I wrote to you in my letter not to associate with sexually immoral people— 10 not at all meaning the sexually immoral of this world, or the greedy and swindlers, or idolaters, since then you would need to go out of the world. 11 But now I am writing to you not to associate with anyone who bears the name of brother if he is guilty of sexual immorality or greed, or is an idolater, reviler, drunkard, or swindler—not even to eat with such a one. 12 For what have I to do with judging outsiders? Is it not those inside the church[b] whom you are to judge? 13 God judges[c] those outside. “Purge the evil person from among you.” (1 Corinthians 5 ESV)
But that does not mean that all separation in the church is good. Jude criticizes those who separate themselves within the church:
It is these who cause divisions, worldly people, devoid of the Spirit (Jude 1:19 ESV)
Separating false teaching out from the church
That separation within the church extends beyond immorality to false teaching as well. At the time at which Paul and the other apostles wrote their context was removing or silencing problematic teachers. This particularly relates to Christian preachers teaching a different Jesus than that taught by the apostles.
For if someone comes and proclaims another Jesus than the one we proclaimed, or if you receive a different spirit from the one you received, or if you accept a different gospel from the one you accepted, you put up with it readily enough. (2 Corinthians 11:4)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 (2 John 1:7)
However the prospect of losing that battle seems to be predicted by Paul’s final warnings to Timothy and 2 Peter.
For the time is coming when people will not endure sound teaching, but having itching ears they will accumulate for themselves teachers to suit their own passions,2 (Timothy 4:3)
1 But false prophets also arose among the people, just as there will be false teachers among you, who will secretly bring in destructive heresies, even denying the Master who bought them, bringing upon themselves swift destruction. 2 And many will follow their sensuality, and because of them the way of truth will be blasphemed. (2 Peter 2 ESV)
Against that is the balance needed to stay and maintain a correct teaching as long as possible. To abandon the church at the first sign of trouble is the mark of a “hireling”:
11 I am the good shepherd. The good shepherd lays down his life for the sheep. 12 He who is a hired hand and not a shepherd, who does not own the sheep, sees the wolf coming and leaves the sheep and flees, and the wolf snatches them and scatters them. 13 He flees because he is a hired hand and cares nothing for the sheep. (John 10 ESV)