The connecting record
shownNaruto · ch. 661–662
Madara Uchiha beat Sasuke Uchiha in Naruto.
Run through with his own sword as he attacks, after one warning; Sasuke loses consciousness, receives Hagoromo's power while near death, and is healed by Kabuto.
What each of them is ranked on
The winner · Madara Uchiha · rank 4
shippuden
Five Kage at once, then the allied army, then the two protagonists together — the war arc keeps escalating what it puts in front of him and he keeps going through it. The only reason he is not first is that he is removed from the story by betrayal rather than by any of it, which is a statement about Kaguya and not about the people who could not stop him.
shownNaruto · Fourth Shinobi World War arc
Fights the assembled Five Kage simultaneously and defeats them. — 2013
shownNaruto · Fourth Shinobi World War arc
Becomes the Ten-Tails jinchuriki and engages the allied forces. — 2014
Beaten · Sasuke Uchiha · rank 6
shippuden
The other half of every fight in the tier above him, and the half that brings the tools rather than the volume — the Rinnegan lets him move between the same dimensions Kaguya uses to escape, which is what turns those fights from unwinnable into merely desperate. Carries the identical paperwork problem to Naruto: never promoted past the entry grade, having left the village before any retest could happen.
shownNaruto · Fourth Shinobi World War arc
Fights Madara with the Rinnegan and a complete Susanoo. — 2014
shownBoruto: Naruto Next Generations · Momoshiki arc
Fights Momoshiki alongside Naruto. — 2016
What this does not settle
One fight in one work. It is the only result the record gives between these two, and it is evidence about that meeting and nothing wider — not a general matchup, not a rematch, and not a ranking of its own.
The ladder above it is argued from everything either of them has been shown doing; this page is argued from one citation.
Where the two disagree, the disagreement is the point, and it stays visible rather than being resolved by whichever of them happens to be on this page.