There's no definitive answer to this question. Disclaimer, my dad flew Mustangs with the highest scoring P-51 Fighter Group in Europe, so I am biased. He flew with such well known aces as George Preddy and John C Meyer.
If air-to-air combat is your only measure, then the P-51 is the superior aircraft. But there are so many different measures, it's difficult to say one is better than the other. Both had kill ratios better than 11:1, and I don't believe that was surpassed by any other fighter. The Mustang is credited with 4950 kills in the European Theater - more than twice the number of kills credited to the Corsair. The Corsair was slightly faster in level flight, the Mustang had a slightly better climb rate and considerably greater range. The Corsair could handle a bigger bomb load.
Some would argue that the best fighter of WW2 was the F6 Hellcat - it was certainly the highest scoring fighter in air-to-air combat with over 5200 kills. The Mustang was second behind the Hellcat.
All that said, there are other factors that should be considered, such as opportunity to engage enemy aircraft, what type of enemy aircraft, how skilled were the enemy pilots, etc. Early in the war, both Germany and Japan had highly skilled pilots due to their combat experience in Russia and China respectively. Late in the war it was a different story.
Also the mission the aircraft was designed for and the mission it was ultimately most used for. There is no question that the Mustang was designed for air superiority, and once the crappy Allison engine was replaced with the Rolls Royce Merlin engine (P-51B and later models) it achieved that purpose.
My personal opinion is that the P-47 is a better comparison to the Corsair, considering both are big heavy aircraft, both are formidable air-to-air fighters that excelled in air-to-ground operations. The Mustang was better than either of the against enemy fighters, and was very capable air-to-ground, although it couldn't take quite the beating the other two could.
I've been lucky in my 70 years to be a spectator to so many discussions just like this one, listening to my dad and his contemporaries from all services argue facts and tell stories. There aren't very many of those WW2 fighter pilots around to argue the point these days. During the years my dad faithfully attended 8th AF and 352nd FG reunions, I was fortunate to meet and listen to many of these great men. Even they could never agree on which aircraft was the best.