There is quite a much price difference between these phones and hence, they can't be compared.
They both are great at their price range and if we really have to choose then the Samsung Galaxy A50 is a better choice.
Processor: The Samsung Galaxy M51 comes with the Qualcomm Snapdragon 730 processor whereas the Samsung Galaxy A50 comes with the Samsung Exynos 7 Octa 9610 processor.
Display: The Samsung Galaxy A50 comes with the Super AMOLED display whereas the Samsung Galaxy M51 comes with the IPS LCD display.
Check Full Comparison Samsung Galaxy A50 vs Samsung Galaxy M51