Thrust is created by accelerating a working mass in opposite direction. Net thrust is the difference between the impulse of the air flowing towards the engine and the combined impulse of burnt fuel and the air exiting the engine (and propeller, if one is fitted), derived by time. That impulse is the product of mass and speed.
When flying faster, the entry impulse of a propeller or a fan quickly grows large relative to the exit impulse, so thrust goes down with the inverse of speed. On the other hand, the high exit speed of a turbojet results only in a small increase of the entry impulse relative to the exit impulse while speed increases.

GSP simulation of a turbojet engine for varying altitude and speed, taken from this answer.
But if that were all, even the thrust of a turbojet engine would drop when speed increases. But there is a second effect which helps to let thrust grow with speed. With the square of speed, to be precise. That is the ram effect which helps to precompress the air entering the engine. At subsonic speed, this just about compensates for the loss of thrust: At low speed, the growing entry impulse lets thrust drop a bit but at higher subsonic speed the ram effect becomes larger and raises thrust again, such that a constant thrust becomes a good approximation (see simulation result in the plot above). However, pressure and thermal limits inside the engine will quickly limit the additional compression in the compressor and the amount of heating that can be added in the combustor. What helps is to fly higher, where outside pressure and the intake temperature will be lower, which more than compensates for the pressure and temperature increase from the ram effect. But then thrust will drop in proportion to density.
So far for turbojets.
Turbofans are a different matter. Here, thrust drops with increasing speed similar, but less severe, as it does in propellers. The nozzles of both the cold outer and the hot core flow only allow the exit stream to leave at subsonic speed, so at cruise speed the fan nozzle is critical or close to this (meaning, exit speed is nearly the speed of sound). In both nozzles the speed can not go up indefinitely and when the core engine exit speed at maximum thrust and low flight speed is already close to the speed of sound, the rule that it stays nearly constant is a good approximation of reality.

Uninstalled thrust and SFC for a large turbofan, from "Airplane Aerodynamics and Performance" by Jan Roskam. Found here.
The steeper trend of the sea level thrust line above Mach 0.7 is caused by the pressure limit of the engine.