How do I fix the side of platforms?

I have a 2d platformer, and I added a solid platform. It works well from the top, but everything shits its pants as soon as the player hits the side or bottom of the platform. What do I do?

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown(KeyCode.Space) && jumps <= 1)
    {
        myRigidBody.velocity = Vector2.up * jumpHeight;
        jumps += 1;
    }
    if (Input.GetKey(KeyCode.A))
    {
        float l = Input.GetAxis("Horizontal");

        this.transform.Translate(l * Time.deltaTime * speed, 0, 0);
    }
    else if (Input.GetKey(KeyCode.D))
    {
        float r = Input.GetAxis("Horizontal");

        this.transform.Translate(r * Time.deltaTime * speed, 0, 0);
    }

}
private void OnCollisionEnter2D(Collision2D collision)
{
    grounded = true;
    jumps = 1;
}

}