Throw this code out. Even in its unformattedness (see below!), I can see that it is based on a defective combination of using transform.Translate() on a physics system object (a HUGE no-no! It bypasses physics) and then it further combines translate with force, which is meaningless.
Combining translate with force is like pushing something to the left while simultaneously picking it up and placing it to the right.
With Physics (or Physics2D), never manipulate the Transform directly. If you manipulate the Transform directly, you are bypassing the physics system and you can reasonably expect glitching and missed collisions and other physics mayhem.
This means you may not change transform.position, transform.rotation, you may not call transform.Translate(), transform.Rotate() or other such methods, and also transform.localScale is off limits. You also cannot set rigidbody.position or rigidbody.rotation directly. These ALL bypass physics.
Always use the .MovePosition() and .MoveRotation() methods on the Rigidbody (or Rigidbody2D) instance in order to move or rotate things. Doing this keeps the physics system informed about what is going on.
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly
Google up some simple 2D physic examples. I know that @MelvMay keeps a handy little repo… but I forgot to keep a copy of that link!! Melv?