How it works is this:
In Melee,
is widely considered to be better than
, thanks to his overall stronger KO power and better projectile. Stronger KO power and projectile doesn't sound too different from today.
However, the thing is that thanks to how their combo game works, as well as the overall engine of the game, it DOES NOT come at the cost of his combo game that much. Additionally, thanks to wavedashing, as well as the stats being not too much different, the mobility difference is usually not that noticeable.
As a result, he actually has a very good approach in that game. He does possess a weaker recovery, but Mario's was very exploitable in that game as well, as well as being in a game where the vast majority of recoveries are not that great.
In SSB4,
heavily trumps over
, with this distinction being even stronger in retrospect. Doc's grounded mobility got significantly weaker in the transition, both directly and indirectly. They removed wavedashing, L-Canceling, and nerfed his Pills. All of this, combined with the universally increased range of the cast since Melee (which also includes Mario in some cases), which pretty much neutered his approach.
Thanks to the engine changes, his combo game is no longer comparable to Mario's. Everything else about how their combo game differs is already covered in Ziodyne's post above.
Now his recovery did technically get better from Melee. However, recoveries got miles better since then, including Mario's, which makes Doc's recovery funnily enough even weaker relative to the cast than in Melee.
Doc was a very poor character in this game, only finding very few niche moments of success. The argument back then was that since Doc has a similar moveset to Mario and solid frame data, he should be better than bottom 10, right? In retrospect, after seeing how lacking Doc is in Ultimate, it does sour SSB4 Doc even more.
In Ultimate,
once again heavily trumps over
. It wasn't always like this. During the first month of the game, everyone thought Mario was mid tier and Doc was a potential high tier. However, now, similar to SSB4, they are on opposite ends of the tier list.
Now as Ziodyne says above: Doc has an actual advantage state now. Moving his slow, small body to the opponent now gives out proper reward, with some damaging combos and even KO combos after reading the opponent's DI. Pills are now better, restoring some of their lost utility from Melee. Additionally, he benefits quite a bit from the universal landing lag reductions of the cast.
So why is Doc still so much worse than Mario?
It is not just because a lot of his crippling weaknesses still remain. It is because some of them got even worse. I covered this more in detail in the past, but his overall mobility is even slower now relative to the cast, thanks to changes made to his mobility multipliers. Being both slow and stubby hurts really bad in SSB4, but now he is even slower in this game in addition of being stubby.
As seen with how DK, Mewtwo, and Lucario fell off in this game in comparison to SSB4, characters will push the opponent's disadvantage as hard as possible in this game. This does hurt, as Doc still has one of the worst recoveries in the game, with the changes to airdodges not helping much.
He is clearly better in Ultimate, now that he gets rewarded for getting in, which is reflected in both his reps and results being higher than in SSB4 (although that is an extremely low bar to clear), but the fight to get in continues to be hard, if not even harder.
He has a few other issues (unsafe on-hit moves and wacky knockback angles), but that is the main gist of things.