To be blunt, they definitely weren't handled all that well, especially in later sagas. They were decent enough to at least make formidable foes in Kanto and Orange Islands, and to a lesser extent Johto (though even there, they had some hiccups, such as losing to a Caterpie that was both a rookie and nearly dead, which also led to their infamous reputation as bottom feeding trainers among fans and even in-universe). But after being retained in AG onward despite Team Rocket as a whole not being involved thanks to Takeshi Shudo insisting they stay on (which if you ask me was a mistake even ignoring that that resulted in Misty being cut), they came across as dead weight. They did get some redemption of sorts in BW where they at least DID try to focus on doing goals besides getting Pikachu (though even there, I really wouldn't say they really proved themselves formidable. Having them beat one of Ash's Rookies effortlessly would have more than sufficed for me), but unfortunately that didn't work out too well and just had them becoming even more badly done. And personally, I wasn't fond of how the Gym Leaders in Hoenn up to about Best Wishes came across as basically Team Rocket clones in skills, or lack thereof.
In fact, seeing how botched they are, it makes me think the writers have absolutely NO idea how to make the main villains be both comedic and a genuine threat, thinking they either make them very threatening and serious, or otherwise so comedic they are pathetic as villains. They ought to take notes on, say, the Red Ribbon Army and especially General Blue. Those guys tended to be very humorous (heck, Blue even acts like James in overall personality in the anime, only unlike James, Blue actually IS Gay), yet they also were shown to be genuine threats to the heroes (Blue, for instance actually managed to beat Goku twice with his psychic powers). I can also cite the Joker or Kefka Palazzo, both of whom were villains who were both humorous and especially grave threats. Heck, even Bowser or Dr. Eggman on their good days came across as both comedic and a genuine threat.
For what it's worth, Dogasu has indicated that Sun and Moon might be their last saga due to their rarely appearing in SM.