I have a question using objects in a 2d orthographic view.

When items eventually touch each other there Z-axis gets shifted. Even though moving left and right only exist on the x axis. Do I just write some kind of script that forces the Z axis to always reset back to z if it's any other number?

How do people take care of this kind of thing?

Thanks.

Yes, you can do just that:

float _startZ;

void Start()
{
   _startZ = transform.position.z;
}    

void Update()
{
   //@ the end of the update function:
   transform.position = new Vector3(transform.position.x, transform.position.y, _startZ);
}