How to get an object to follow you along a certain axis?

I’m a beginner in Unity, and making a 3d platformer kind of game. On the one level I wanted to have an enemy(boss, if you wish) be in the distance, and shooting at the player, who would have to dodge the projectiles to get to the end.

Somehow like in this overhead view. If the player goes out to the side, the “Boss” would follow, but only sideways.I hope I was specific enough, for you to understand.
(This is my first game, so I’m not that experienced. Yet.)

Just have him follow you but zero the elements of the Vector3 you don’t want him to move in.