Star Trek The Next Generation has one of the best, if not the best, finale to an ongoing episodic tv series ever. I don’t want to compare it to the kind of shows that are just one big story split up into hour long chunks, because that’s a totally different style of show and many have good endings. But for shows that are mostly separate, TNG did it better than any show I can think of.
It did a fair, but not gratuitous amount of fan service, and it was all in service of the actual plot. And it still somehow felt like a good episode of the show. But it also perfectly bookended the show back with the very first episode of the show. It was as close to perfect as you can get.
DS9 turned into an ongoing story that was just broken up into hour long chunks though. So it’s ending isn’t really comparable to TNG that stayed episodic all the way through.
Only at the very end, and the beginning of S6. Other than those, it was still an episodic show with each episode telling its own story against the backdrop of the war.