Those who fought single-handedly against Thanos in Infinity War and Endgame are: Doctor Strange, Thor, Iron Man, Captain America, Wanda and Captain Marvel.
This is my personal ranking:
6: Captain Marvel
She was fundamental to stop Thanos from snapping his fingers again, and by absorbing the energy of Stark’s Infinity Gauntlet she was able to receive a headbutt without even the blink of an eye.
I put her in the last place just because the fight was relatively brief and not particularly effective to neutralize Thanos. Despite that, she surely helped to buy precious time.
It pains me to place him so low in the list given that among all others he was actually the one who almost kills Thanos in Infinity War. However, his can barely count as a confrontation, since it lasted just a few seconds and he also caught Thanos off guard, failing anyway.
Hers was one of the most effective fights. She actually managed to overpower the sword-wielding, bloodthirsty Thanos of Endgame. She could have killed him if he hadn’t called for backup.
3: Doctor Strange
Perhaps the most visually stunning battle among all those considered here. I place it on top of that of Wanda because he was the only one who forced Thanos to use all the gems he had. In addition, he had to deal with a Thanos capable of long-range attacks thanks to the gems, while the Thanos Wanda fought did not have this advantage (except for his sword, which had been taken from him anyway).
Without the gauntlet, Thanos would be hopeless against him.
2: Iron Man
He fought very cleverly: he blocked the infinity gauntlet first:
Then he obscured Thanos view and hit him with rocket boosted battering rams, while well anchored to the ground.
Unfortunately, he didn’t resist for long, but the mere fact that a human with his invention only withstood Thanos with 4 gems for a minute, and even managed to make him bleed, is more than remarkable.
1: Captain America
The fight with Thanos was simply exceptional. Combinations with Mjölnir and his shield were creative, lightning-fast and very effective. He created a shockwave that brought Thanos down by hitting his shield with the hammer, showering him with blows by swinging the hammer and hitting him with the shield at point-blank range.
He also used both weapons to hit him from a distance (always going for the head, eventually enough to break even Thanos’ helmet).
And he summoned lightning bolts that knocked down Thanos multiple times.
All of this in a matter of seconds, leaving Thanos almost no time to fight back. Maybe if Thanos hadn’t dodged Mjölnir’s final blow while on the ground, Cap would have even managed to actually kill him.