To achieve that task, you can use BoxCollider2D or PolygonCollider2D. Attach it to both objects, but make it 5 pixels larger for the first object.
Then write code, that kills the object, in the OnTriggerEnter2D / OnCollisionEnter2D event handlers.
To destroy the object you can use method Object.Destroy, just pass the desired gameObject reference to it.
Here's the reference materials: BoxCollider2D
Also, you can cast rays of limited length, how to do so described in the following link:
How to cast ray2d in Unity
Also, I strongly advice you to learn through this section and watch all the materials, because what you've asked is really basic question, you should at least watch the tutorials in the learn section on Unity site, so you won't ask the questions like this in the future.
Here it is, please watch it
other? \$\endgroup\$otherobject moves. have you assigned theotherobject correctly in the script holding object's in inspector. you may have assignedanothernot moving object. \$\endgroup\$