Edit: to be clear the difference stems from our coordinates. Our starting points are:
41.059167,77.683333 (me)
41.0181,77.6708 (you)
And our end points are:
36.295364,78.755593 (me)
36.314,78.7654 (you)
Also I calculate the distance assuming the Earth is spherical (which gives 538 km) not the standard geodesic (which would give 537 km).
And in the DEM data I measure the distance from the center of a cell to another (not the edge), while measuring from edge to edge may explain a difference of at most 0.1 km as the DEM resolution is 3 arcseconds.
So clearly we disagree on the coordinates of the exact actual sightline as we have a 7 km difference :-)
Edit #2: clearly the error is on your side. I should have checked this first, but the coordinates you give for the "To" point (41.0181,77.6708) land in a valley with the south view completely blocked so it's impossible to view 500+ km south as you claim. Look at where the marker lands on this Google Maps Terrain: https://maps.app.goo.gl/PgBWxi31WZC6vk3V9