It's essential to be around people of the same school of thought in the things of God so you can continue to grow in them. 
But how do I spot a bad relationship or friendship? 1 Corinthians 15:33 tells us, "Be not deceived; evil communication will corrupt good manners." According to John Piper, "avoid relations with unbelievers in which your relation endorses the unbelief or consequence and avoid the kinds of relationship that involves the interweaving of deeply personal values." What he's saying is to avoid friendships with unbelievers that cause you to be okay with opposition to God's law. And avoid relationships that cause you to mix worldly ideas with biblical ideas.

I'll admit that in the past, I'd been desperate for friendship and was willing to hang out with anybody. I've learned that praying and asking God to send godly people and relationships into your life is more important. He knows everyone and knows who is best for me and who I'd be best suited for. Ecclesiastes 4:10 says, "if either of them falls, one can help the other up. But pity anyone who falls and has no one to help them up." So I take courage and comfort, knowing that God will never leave me alone. There will always be someone to help me up.

Works Cited
The Bible, King James Version.
The Bible, English Standard Version.