Don't make friends with bad people, in the first place.
Be patient, observant, and slow to striking up a friendship till you know as much as you can about the person.
Make new friends. Politely decline their offers to go out, if their asking. They'll get the message that you don't want to hang out with them anymore