What you're looking into is measuring a distance on google maps. Unfortunatly, this is not a question to which an easy answer can be given, but you might consider one of these ways :
- The least accurate way : the haversin formula ,
- Ellipsoidal Earth projected to a plane formula (since Google Maps is based on a Mercator projection and a WGS84 Datum, this formula may yield better results if you succeed in putting it into an algorithm),
- The cleanest of ways, which will yield the best results, is to reproject your map into a local coordinate system (CS) and then mesure the distance on it ;
Let me now focus on this last bullet : google maps uses a coordinate system called "Pseudo Mercator" or "Web Mercator" which have the code EPSG:3857, I live in Morocco, so the coordinate system I should use is EPSG:32630, depending on where you live, you should pick a convenient coordinate system for accurate results. Once you pick your coordinate system, your should look for a the mathematical tranformation between EPSG:3857 and EPSG:XXXXX (your local CS) or leave it to a third party library to carry such transformation (depends on which tools you're using).
Edit : just forgot to mention that if you want a third party library that can handle tranformations, look up Proj4 or PROJ4NET for C# programming.