That effect in Fellowship of the Ring is known as a zolly, or “the Vertigo effect” (popularized in Hitchcock’s Vertigo), and it is usually done in camera. It is achieved by dollying the camera in or out, while zooming in the opposite direction so that an object at your focal distance remains the same size in frame while perspective is exaggerated or diminished around the object due to changing focal length/fov. For example, dolly forward and zoom out. Or dolly backward and zoom in.
It’s quite tricky to get the speed right, and it works best with shots that have lots of depth, and multiple layers of foreground and background depth.
I have not heard of an effect in AE that is designed to do the same thing to footage. I imagine the in-camera version of this will always be the best way, but there may be a digital effect that mimics it.
You could definitely do it with 3d or 2.5d in After Effects without an effect filter if you have 3d objects at different depths, and you animate the virtual camera to push in or out and zoom in the opposite direction at the same time. At that point it’s just optics, just like in a real camera.