I'm asking if I mention that I want to find the optimal path using the fuel as cost, does the heuristic function take into account the length and the time of each segment implicitly?
No. Both algorithms find the shortest path based on 'cost'. But you have complete control of what cost is.
As @1saac points out, A* prioritises moving towards the target, but both will give the same result. The A* makes an assumption, though, that moving closer to the target will speed things up. This is generally true if the cost is something like distance, but may not be for other costs.
Cost is typically something like length, time (=length/speed) but it can be any positive number - e.g. fuel consumption, toll road fees etc. that you want to minimise.
You could mix two costs by using a weighted formula e.g.
cost = (1*length)+(3*fuel_consumption)
If you normalize your length and fuel consumption values to a consistent range e.g. [0,1], that will give a weight of 3/4 to the fuel consumption and 1/4 to the length. That will prioritise saving fuel, but also add a small component of length (for example, to account for wear on tires).
I would recommend trying both - the A* optimisation may not be as effective as it would be if you were using length as a cost, but it really depends on your network.