Professors meeting undergrads in social events
It would certainly be unreasonable to expect professors to leave a church because the church also has undergraduates in it.

What you're describing isn't really what's usually called a conflict of interest: the professor doesn't actually stand to gain in any concrete way by giving the student better grades.  What you're concerned about is bias, which is a real, but generally lesser, problem.  It's basically unavoidable to have some potential bias involving students - professors will inevitably end up with students who they know from outside school, or who are identifiably the children of a colleague or administrator or donor, or who we just find ourselves naturally liking (or disliking).

It is the responsibility of a professor to avoid letting this bias turn into favoritism, or even the appearance of favoritism, but the usual approach to this is to have clear standards and try to grade blindly (without knowing whose work we're grading), not to try to eliminate all possible sources of bias.