Whether or not it works may in part have more to do with the persons involved, the power dynamics in the relationship, level of experience, and financial equity also plays a role, maybe maturity, although I'm not sure that matters as much anymore. If you're just having fun, maturity doesn't really matter. Really depends in part on what people are looking for in a relationship.
I think many of them are misguided because they are presented as real, sustainable relationships, based on love, etc. but they're really just about status, sex, and trophyism. Sometimes, there are real incompatibility issues but these aspects are pushed aside or ignored. Nothing is wrong with having fun but pretending the relationship is more than it just looks just makes the relationship seem forced. Our society tends to celebrate these relationships as awesome and cool because someone got a much younger, highly attractive, person to be with.
I also think some include an element of ageism from older to younger, and vice versa.
My view is that if you're going into one, be honest with yourself at least about why you're attracted to them, how your relationship will actually work in practice vs. ideal or overly romanticized views of the "May-December" romance, and the potential for a few unexpected challenges, disagreements or misunderstandings that will likely occur due to generational differences. I think people like to pretend that generational differences don't matter because of this notion that "age is just a number." Everyone thinks it's so cool to say age is a non-issue, but it is. No, it's not just a number. It matters.
That number difference can signify a huge difference in perspective and understanding of the world and what to expect, so to claim it doesn't matter is short-sighted and misguided. Don't get me wrong, I'm not saying age-gap relationships can't work, but don't be unaware or ignore the way age differences can affect relationship dynamics. You can pretend it doesn't matter, but it will likely have an impact and you will have to deal with it in some way, even if you tell yourself it doesn't matter. As long as you're willing to acknowledge and address it when it comes up, then I believe you can have a great relationship. Just don't pretend that it's a non-issue.
I've noticed that many couples have a lovely relationship when everything is going well, but once one partner gets sick or starts to age more quickly as they get older while the other is still relatively fit and healthy, especially older age-gap couples, then the relationship dynamic changes. In other scenarios, when the relationship stops being fun, exciting, entertaining, interesting, or adventurous, then the relationship tends to fizzle. Once the novelty wears off, then it's splittsville. In any case, most relationships today focus on short-term vs. long-term compatibility so it's probably not surprising many relationships, not just age-gap relationships, end the way they do.
Edit: Sometimes, people do look for stability and maturity in relationships with older partners only to find that the person may not be as stable or mature just because they are older, and the younger partner may find themselves being the more responsible partner far more than they expected to be. That can be a burden on the relationship, because of the inequality in responsibility.
Another aspect that affects these relationships significantly is culture. Cultural expectations have a huge impact on age-gap relationship dynamics. Culture may even matter more than age. But that's another thread.