The context is an 3D engine with a 2.5D level format. Like a roller coaster tycoon level, with some other level features added, and layers removed. For example the tile functions have the following interface.
This statement places a mark on the tile located at 3x5. This tile can be on top of a mountain or a cave, but different tiles on the same height can't exist, so the Z axis isn't needed. Internally everything is in 3D, but it isn't exposed to the interfaces since there can't be more than one tile at the same X, Y position.
Because the tile functions are 2D, units also store their positions in 2D.
markTile(unit.position); // place a mark where the unit is
There are also cases where knowing the Z of an unit is useful, but it is almost never about the tile or the placement position. For example it is useful to create a sprite or an exclamation mark on top of an unit, but that is done by using the Z from the tile and the height of the unit. That interface also uses an unit as the parameter, not a position, because multiple units can be on the same position unlike a tile.
Now, I am wondering, is there a need for the raycaster to even return the Z data in this setting? I can't think of a gameplay case. I can think of cases where the unit height is important, but none that would need to know the Z from the ray. I can also think of cases where I could want to place an effect on an exact position on the unit, but that can be done by just X and Y(floats, not ints) as well.