One Piece's light hearted tone is only skin deep, it's always been way darker beneath the surface. The second bad guy in the entire series was a corrupt marine. That undercurrent of darkness and corruption allows it to get away with a lot more than it would be able to without it. Hell, in the first chapter Luffy is kidnapped by bandits and almost killed as a result. This lets One Piece ramp it up in future issues by establishing that things can go dark very early on in the story. Dragon Ball is much the same, but it doesn't go nearly as dark. What you can get away with is set up by how you construct your world and story.
I honestly don't think One Piece is particularly dark. It touches on serious subject matters frequently enough but the artstyle, the nature of most of the characters, how things are resolved etc. really stops it from really getting heavy. The good guys win, the bad guys lose, there is little sense of gray, etc.The removal of the consequence of death for the most part (among other things) really puts a damper on how dark things can get. It's a IP that does well to appeal to a wide range of audiences but I often get the feeling that because many adults can enjoy it that they over sell its "maturity" or its "darkness".
Anyway, going into the Fairy Tail vs. Berserk conversation (this is a response to everybody), I'll admit I've only seen/read a little bit of each property - I'm not nearly as familiar with them as most in here are I feel. The thing that works to distinguish them besides context (dark shit in a dark world and dark shit in a light world) is how the material is framed and what it is trying to achieve. In Berserk, fucked up shit happens to demonstrate the world is fucked up (at least to my understanding). Fucked up shit, of a sexual nature, in Fairy Tail seems to happen with the aim to titillate. Titillation isn't inherently wrong but it can be jarring and off-putting if its not what you signed up for. Its the same reason fanservice, of the sexual nature, isn't created equal. How gaze is used, how agency is distributed, how congruent it is with the character, scenario and general world, etc. will all influence how its perceived. Even with my limited knowledge of those two properties, I can tell both works have different aims and use sex and sex appeal in different ways.