You can't use target selectors with
z alone. You need to provide some additional information to the target selector.
Here are some additional things you can provide.
rm: Selects entities by distance. For example:
means that entities not more than 5 blocks away from (0,0,0) but not less than 3 blocks away will be selected.
dz: Selects targets in a rectangular volume.
This one is more complicated, and it's too much to explain clearly in this answer. But you can find more about it in the Minecraft Wiki: Commands
The Minecraft Wiki also states about the
Define a position in the world the selector starts at, for use with the
distance argument or the volume arguments,
dz. Defining the position alone can be used with a target selector that selects the nearest entity from those coordinates, but it otherwise has no use, so applying it (and only it) to
@e still selects all entities in the world.
This means that it won't be easy to select everyone on a certain Y level. You should instead use a different approach, by testing for everyone nearby a certain point in your world using the distance arguments,
rm. If you still want to select everyone on Y level 118, you should consider learning how
dz work using the links above.