Try $f(x,y)=x^2+y^2$, $f \colon \mathbb{R}^2 \to \mathbb{R}$.

If you want connected constant dimensional fibers, try $f(x,y,z)=z$ on the cylinder with one point deleted $X=\{(x,y,z)|x^2+y^2=1\}-\{(1,0,0)\}$.