Solomon repeats Proverbs 21:9. The repetition of proverbs is one reason for believing that we must see them as arranged in themes, so that their meaning is determined by the surrounding block of verses in which they are placed.
The believer finds the company of the worldling to be uncomfortable. In many areas of life the Christian is obliged to be alongside those who do not know Christ and to put up with their ways. At school or at work or even in the home for the sake of family, we must live alongside them. We may have to bear their language, their cursing of God, their speaking evil of high and holy things, their carnal solutions to problems which they do not understand, their worldly tastes, but we are not permitted to go out of the world. The lesson of this verse is not that we are allowed to isolate ourselves from the world as those who take a monastic vow, but that we do not seek our closest friends among them and we do are bound to find their company distasteful in many ways, so that we prefer to be with God’s people or alone with our God.