the distance is independent of mass:
the friction performs work equal to the kinetic energy of the truck
if you increase the mass of the truck you increase its kinetic energy, but you also increase the frictional force (by increasing the normal force) by the same amount.