In the FIT_RECORD_MESG struct, there is a distance field. It obviously contains the accumulated distance since the start of the activity. (in meters * 100) This is also the distance used in the Connect app. But, for unknown reason, there is sometimes a significant difference between this distance and the one if you calculate it out of the position_lat, position_long fields with the haversine algorithm.This matches also the same distance if you import the GPS data e.g. to google earth. For an actual activity, it sums up to about 400m for a 5.8km jog. (recorded with Fenix 6+ watch).
Total distance out from distance field: 5411m
Total distance calculated with haversine algorithm: 5810m
I observed this differences especially when the GPS reception is not optimal, e.g. in the forest, but the GPS data itself seems to be reliable. (Older files from the same track recorded with a Forerunner 235 did not show this huge discrepancy)