Re Gus Horsely's statement of the effect of an impermeable formation (an aquiclude).
In some situations it can also confine water below it.
The eample I know particularly but I am sure is not unique, is that of the phreatic phase of the long-fossil Blacknor Hole, on Portland. There, a chert seam about 100mm thick within the limestone trapped what seems to have been two concurrent, roughly parallel, inlet streams below it, creating extensive anastomoses between them in the area approaching their meeting-point - named literally 'The Confluence'. Eventually vadose down-cutting, probably from base-level fall, left the chert roof high and dry.
The rock is the Late Jurassic's Portland Formation; the detail bed being the Cherty Series (modern texts seem to ignore such internal variations even where plainly significant, on Portland commercially as well as scientifically). The structure is the gently-dipping Southern limb of the Weymouth Anticline, of Tertiary age; the folding created a strong rhomboidal joint pattern.
Elsewhere in the area, we see passage morphology apparently affected by the limestone, but the caves lost their catchment area and many passages to coastal retreat, and are now highly fragmented by quarries, so trying to deduce what went where and how is almost impossible.