Same as anything else, really. If they say or do something that’s inappropriate, you sit them down and have a discussion about why it was inappropriate. Use it as an opportunity to teach the child the right way to treat other people. That’s the whole reason why children have adults in their lives, to teach them right from wrong and protect them from harm. Children who are old enough to actively search for sexually explicit material probably aren’t going to be harmed by viewing the sexually explicit material itself, but if they’re viewing sexually explicit material of adults in their lives, then they should understand it would make those adults uncomfortable, so if they’re going to look at porn they should stick to (consensual) porn of strangers (obviously with the caveat of “porn isn’t representative of real sex and can be problematic in its own ways” but that’s its own discussion).
Same as anything else, really. If they say or do something that’s inappropriate, you sit them down and have a discussion about why it was inappropriate. Use it as an opportunity to teach the child the right way to treat other people. That’s the whole reason why children have adults in their lives, to teach them right from wrong and protect them from harm. Children who are old enough to actively search for sexually explicit material probably aren’t going to be harmed by viewing the sexually explicit material itself, but if they’re viewing sexually explicit material of adults in their lives, then they should understand it would make those adults uncomfortable, so if they’re going to look at porn they should stick to (consensual) porn of strangers (obviously with the caveat of “porn isn’t representative of real sex and can be problematic in its own ways” but that’s its own discussion).