Move an object relative to another object's axis

How would I do this? I figured out a way of getting the distance I need it to move by, I just don’t know how to make it move along the other object’s axis. Is there a way of doing this without making it a child of that object? Thanks

I tried something like this but it doesn’t work:

transform.position = Mathf.Lerp(transform.position, otherObject.forward * distance);

Maybe you are moving along the object’s world axis.

The position showed in your inspector, that’s local axis.
try use 「otherObject.localPosition + Vector3.forward * distance」, maybe can help you.

Good luck.