Charge-state dynamics of 1.4- and 11-MeV/u uranium ions penetrating H2 and He gas targets