I have remained friends with a good portion of exes. However, the ones I am cool with I've known 10+ years and we only got that way once I (I repeat, not we) was definitely over them. Once I decided it was over even after it was over, being platonic was effortless even if I knew they had feelings. It was there decision to be cool with me. However keep in mind, I rarely initiate contact. They always reach out to me but we're cool, no drama, no nothing.
Jesus had non-righteous friends so you shouldn't eliminate people in your life based on that criteria. Your life could be a potential testimony to them. You should eliminate people that you believe do not have your best interest in heart or that influence you to sin. You need to separate from these people, saved or not saved.