This is always a tricky one for me. On the one hand, I really don't want my kids hanging out with someone who is a bad influence. On the other hand, maybe my kid can be the good influence that the other child needs.
We've had this problem mostly in the early teen years (13-14), but it's pretty manageable at that age. I've tried to make sure that the other child is invited to our home a lot so that we can get to know them and be able to give educated advice. (It's much easier to talk to your kids about specifics if you know about it first hand) It also helps me to understand more about where the other child is coming from. Do they have a bad family life? Am I only judging the outer appearance? Is there a good kid buried deep inside?
Usually, the friendship doesn't last and my kids move on to other friends who have more things in common. Only once have I had to step in and end a relationship, but that was an unusual circumstance. As a parent I only play that card when absolutely necessary.