Z value of a 3D peg

Is there a way of finding the Z value of a 3D path peg, to use it on a function?
On separate Mode, I can share the Z value of the peg. But how can I do it on a 3D path peg?

Thanks in advance