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 DestroyObject()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:
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.