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.
There are plenty of ways for professors to "make favorites" without knowing students ahead of time. It's up to the integrity of any professor to prevent such favoritism from impacting the learning of other students or the grading rigor for a course. Professors have the same ethical obligation with respect to categories such as race, gender, political affiliation, etc.
It isn't reasonable to expect a professor to withdraw from social circles where that professor might encounter students (or, for that matter, the parents of those students).
In some cases, it might be reasonable for a professor to recuse themselves from some other administrative action involving a student closely known to them (for examples: admissions, any sort of disciplinary action, awarding of scholarship money, etc) assuming there are other faculty who can easily fulfill those roles.
The role of a professor is to teach. Grading is an artefact of the educational system: a necessary evil, if you wish. Grading should be as objective as possible, and ideally a didactic tool. A professor that likes his students is motivated to do what's best for them in terms of learning.
To a see a professor as a referee in a grading competition is a symptom of what is wrong with the current academic status quo, where a university degree is a tool for social and economic advancement. In any case, a university is not the same as military hierarchy, where officers are not to mingle with the ranks. A university is, at least in principle, a place for the free interchange and creation of ideas, not only in the formal setting of the classroom, but always. A professor interaction with students outside the classroom is a good thing.