A note of caution regarding this flashback to physics 101... I'm no expert in this subject and some very broad statements (technically inaccurate) will be made for the sake of simplicity.
Work, as defined in physics, is force times distance. The amount of work is the same regardless of the time it takes to cover the distance. If we walk 1Km the amount of work is the same whether we do it at 4Km/h or 5Km/h.
Energy is the capacity to do work. The same amount of work done, means the same amount of energy was consumed.
This is theory. In practice walking 1km at 5km/h will consume a little more energy than doing it at 4Km/h. The net amount of work accomplished is the same: your body was transferred 1Km, but slightly more energy was consumed. Factors like, changes in the efficiency of stride, the non linear relationship between wind resistance and speed, etc., affect actual amount of energy consumed even though the net amount of work has not changed.
The important point here is that for a given distance, even though an increase in speed increases the amount of energy spent, the effect is relatively small. I'm not implying we will spend the same energy on a 100mt dash as if we strolled down the field at little more than a crawl but that would be taking things to the extreme.
All the above also applies for a bike except that relevant differences in energy spent will creep up at smaller differences in speed; mainly because on a bike you generally travel faster than on foot so the non-linearity of wind resistance will have a greater impact.
Calories and energy
Calories are a measure of energy so if we can measure the calories we spend going from A to B we will have a sense of how much work is involved in covering the distance from A to B.
The caveat is that two individuals riding side by side at same speed won't consume the same amount of calories because among other things, of differences in weight and efficiency.
But for a given trajectory, the same individual will consume roughly the same amount of calories every time as long as each ride is done in more or less the same mode; examples of mode being "all out", "leisurely pace", etc.
Where does this leave us? By looking at someone else's calorie expenditure over a trajectory done in stages, we can gain a good idea of the relative difference of work required to cover each stage. That is, if the calorie expenditure for one stage is X and for another it's 2*X, we can assume can assume the second stage requires double the work to cover. All this of course if all stages were done in roughly the same mode.