Smoothly moving object along 1 axis

I have 2 gameobjects: obj1 and obj2

I control obj2 along the x axis manually. I want obj2’s y position to slowly match obj1’s y position. I can’t use Vector3 Lerp, as I control obj2’s x movement. I only want to lerp the y axis.

How do I do this?

My attempt:

obj2.transform.position = new Vector3 (obj2.transform.position.x + myManualInput, obj1.transform.position.y, 0);

This however, instantly jumps to obj1’s y position. I want it to move smoothly.

Attach this script to Obj2 and when you move Obj1 along the Y axis, Obj2 will follow

public Transform Obj1;

 	    private void Update()
        {
            Vector3 NewPos = new Vector3(this.transform.position.x, Obj1.position.y, 0);
            this.transform.position = Vector3.Lerp(transform.position, NewPos, Time.deltaTime);
	    }