Y'know, it's funny. I see a lot of Chapter 5 Flowery discussions paint him as one of two things: the biggest douchebag on the planet, or the perfect guy trying to service everyone, including Asgore, the Flowers, the Darkners of Flower Kingdom, and the Fun Gang themselves. I don't deny that Flowery imagines himself in that role, but... I don't think he actually does a very good job of doing that early on if that was always his intention. Heck, several times he tells the heroes to screw right off and not get involved, and it's not in the baity way he asks "what gives you the right to keep your fountain but seal ours" when he's making sharp rhetoric.
Early on, his style is much more of a "I'm strong and can do everything right and make this world perfect, and it'll end anyway, so you heroes can kindly just leave." That's what he wants. He doesn't seem interested in making the heroes grow, especially being mentor-like to Ralsei like how he becomes later. If anything, he reads as kinda spiteful, and I wouldn't be surprised if it's for reasons similar to the ones that Ralsei holds against him. Their aggression, at least in my view, reads as a two-way street; Ralsei has a plan that dehumanizes him that he hates and doesn't acknowledge themself in the process, which kinda goes against everything Flowery stands for, and vice versa Flowery's carefree attitude, demeaning behavior, and utter lack of plan or interest in his own perpetuity pisses Ralsei the hell off. I don't see Flowery-as-mentor or Flowery-as-rival... yet.
When Flowery realizes that the heroes are not backing off to let him and the Flowers watch the sunset (they are rather literally sunsetting, which is all sorts of depressing when you stop to think about it), though, he can't just be an asshole anymore if he wants to follow his own code. He has to acknowledge them, and regards them more as worthy opponents when they ignore his first warning and come back despite getting Asgore to push them out of the Dark World. Nobody is leaving this situation be, and it's here that Flowery gets to fully self-actualize. He gets more scenes where we see and hear about how he helps others, and we get the absolute smoking gun of that drink voucher scene where he drops his demeanor and genuinely just talks to Ralsei about their process, only jabbing at the inconsistencies and making them come into conflict with their own cognitive dissonance. He's having to live up to his own standard of humanization, and does so through mentorship.
And then, once the Heroes have gone past all the prior obstacles, it's time to be the rival. He stresses his "power of friendship" stuff, emphasizes himself as just as much of a hero, if not moreso than they are. His argument about the fountains, logically speaking, is utter bullshit, but he knows that and still manages to convey a strong rhetorical point. If they really want to shut him down with logic, they're okay giving up the humanity of others for sake of an end they don't desire. He himself cannot be saved, no matter what happens, but the party has never been able to deny the humanity of others no matter what they believe about themselves, and he forces them to confront that truth in a way that makes them question their own processes. This is his finest work, and what makes him a truly effective villain.
We've dealt with assholes, we've dealt with the selfish, we've dealt with seemingly unstoppable forces, we've dealt with those who are devoid of conscious, but we haven't dealt with someone like him in his final form. He's an excellent progression in the story's stakes precisely because he is also a layered, flawed character who can be selfish, rude, and narcissistic, and yet someone who can still grow to be a mentor and well-meaning rival despite that growth amounting to theoretically nothing.
Basically, I just love that Flowery is so incredibly human who tries his best (to parrot Blue a bit) to transform an inevitable tragedy into the form of a classical comedy. He may die, the Flowers may lose themselves forevermore, but he grew in spite of it to offer something that can bring things to better than the status quo. If the villain can be a hero, what's stopping us from being even better heroes?