We do have to be discriminating about who we "hang" with. Jesus was known to associate with the ungodly, and was reviled for it, too. But His friends were His followers, those who had a love for Him.
Psalm 1:1-3 (NLT)
Oh, the joys of those who do not
follow the advice of the wicked,
or stand around with sinners,
or join in with mockers.
2 But they delight in the law of the Lord,
meditating on it day and night.
3 They are like trees planted along the riverbank,
bearing fruit each season.
Their leaves never wither,
and they prosper in all they do.