By being conscious of our language and choosing positive, respectful topics. For example, talk about hobbies, work, or current events.
To avoid such topics, first, we need to educate ourselves on what is appropriate and inappropriate. Second, set boundaries in conversations. If you notice a conversation is heading in that wrong direction, be assertive and change the topic. Moreover, promote a culture of respect and decency in the groups we are part of, so that everyone is aware that such vulgar topics are not welcome.
We can avoid such topics by having good moral values. Always think about whether the topic is appropriate for all audiences. Also, if someone starts such a topic, gently steer the conversation in a different, more positive direction, like discussing a recent book you've read or a movie you've seen.