The first law of thermodynamics relates to the conservation of energy. You can never get more energy out of combining hydrogen and oxygen than it took to separate them initially, even in a perfectly 100% process. Of course, such a 100% efficient method has not been developed - there will be losses at every stage. There is no magic method to dissociate hydrogen and oxygen from water - you will ALWAYS need to input more energy to break those bonds than you can ever get back by recombining the gases. Then when you have collected the oxygen and hydrogen, you will have to cool and compress them so that they can be contained in volumes modest enough to fit in a vehicle and be burned in its engine (ICE, turbine, whatever). All this requires a large and power-hungry infrastructure.
There will be combustion heat losses no matter what type of engine is used, and losses due to friction. If you decide to use fuel cells, there will be resistive losses, perhaps 50% heat loss, and some additional loss due the transport of unreacted fuel - then there will be additional losses in the electric motor and drive train.