Even if you and your friend do an activity together, it is possible to get different distance calculations on Strava. In most cases, this will be because one or both of your GPS devices recorded location (or other) data that does not accurately represent your activity. Things like GPS drift, GPS signal loss, or a 'jumpy' GPS track can cause your activity to report more or less distance than you actually traveled.
Below is an example of both GPS drift (the recorded path is just slightly 'off' from the road) and a 'jumpy' GPS track. The distance for this activity was inflated because each '**bleep**' and 'zag' of the GPS track had to be accounted for with a straight line connecting them. Strava does some smoothing to compensate for bad data but some cases are so extreme that we aren't able to provide a realistic estimate of your distance.
Why is my distance on Strava different from my GPS device?
Many devices will write their own distance stream into the activity file that may include information from sensors like wheel sensors. Strava will do some smoothing to the uploaded data to remove outlier GPS points but, in general, if we use your device's distance stream, you should see a similar distance on Strava as you did on your GPS device. If a device does not write a distance stream into the file whatsoever, we would use the GPS data to calculate the distance by adding up the distance from the GPS point to the GPS point. Again, we would do some smoothing to remove outlier GPS points - this includes inaccurate GPS points and data that is clearly inconsistent with the file.
There is a threshold of outlier/bad GPS data that will cause Strava's file parser to recalculate your activity's distance by blending the GPS and device distance together in order to correct those areas with bad GPS/device data. This bad data detection is an effort to improve the quality of uploaded data on Strava and does solve many issues with GPS inconsistencies. This reprocessed distance can differ from the distance data originally reported by the GPS device, especially if a speed sensor is present.