While I’m not entirely sure how, here are a few what ideas. If you’re coming into fanfic new, here is what you need to know. Perhaps other folks can think of more diplomatic ways to frame these thoughts.
Fandom has historically been dominated by the weird. Weird people, weird stories. That isn’t a bad thing. A lot of folks in fandom wear weird as a badge of honour, something we reclaimed from bullies and other abusers who slung the word and related ones at us. We are not normal and do not seek to be normal. If that idea bothers you, you are still welcome, but know that you are a guest. A lot of folks in fandom have been burned by aggressive normalcy, and start baring teeth when it intrudes into our spaces.
The author is dead. All this means is that the original canon author or authors can tell you their interpretation of the story, but they cannot control your own interpretations or imagination: their interpretation is no more or less important than anyone else’s. Something being noncompliant with canon does not make it badly-written.
Alternate universes exist. If someone wants to write characters from a serious crime drama in a sitcom, they are allowed to do that. If someone wants to explore what would happen if that horrific mass murderer was redeemed or never evil, they are allowed to do that. If someone just really likes dragons and wants to write about everyone being a dragon, they are allowed to do that.
If you write fanfic, you are also an author, so you are also dead. Once you release your ideas into the wild, other people can and will do weird things with them. The sooner you accept that, the better.
You will find porn of it if you go looking. If you don’t, some folks will take that as a challenge and go make some. As long as good-faith efforts are made to keep out people who shouldn’t or don’t want to see it, there is nothing wrong with this.
A canon being made for kids and teens does not mean that all sections of the fandom are for kids and teens. Adults can be into works for the younger set, and as long as there are clear boundaries between work that’s appropriate for kids and work that isn’t, there is absolutely nothing wrong with that, and absolutely nothing wrong with adult or dark works based on those stories.
Some people will really hate your favourite characters. Some people will think your favourite pairing is gross, or boring, or that the characters would be better off with someone else. Some people will think that show or game or book that got you through the roughest moments of your life is absolute trash. And that’s okay. Not everyone has to like your favourite things.
Someone writing dark stories about terrible things happening to your favourite characters, even dark stories that may mirror some trauma you’ve been through, are not writing about you. They’re not. It is none of your business why they’re writing it. Their only duty to you is to make sure you can avoid their work if you want to. Again, the sooner you accept this, the better off you’ll be.
It’s okay if you want to write something dark and depraved. Lots of people do, and if it’s weird, well, fandom has historically been dominated by the weird.
It’s okay if you want to write nothing but fluff.
It’s okay, no matter what you want to write.
Just be courteous and tag your work. Even if all you want to tag it with is “this may contain dark topics.”