Set clear boundaries in communication. If someone starts to bring up such topics, firmly change the subject or indicate that it is not acceptable. For example, you can say 'I don't think this is a proper topic for discussion.'
First, be self - aware and know what is appropriate. Avoid engaging in conversations that seem unethical or inappropriate from the start.