How To Mask A Light Function Above A Certain Height?

Hello! I am using a light function to create an underwater caustics effect. I like how it looks to see the caustics from above the water line as well, but my issue is that the light function affects everything above the water line as well. If I can’t figure this out, then I will just have to disable the light while above the water, but I am hoping there is some way to mask the light function in such a way that it is only visible below a certain z-level which I can control through a material instance.