Clipping during collision problem

Hello! I am making a 2D platformer and I ran into this problem where the player character will clip into a wall whenever the player holds down a movement key in front of a wall.

I have tried putting the movement code in the fixed update function along with making collision continuous, however doing this only helped a little bit.

Is there a way to fix this?

my movement code:

    void FixedUpdate(){
        // horizontal movement
        if(canMoveHor){
            float horMovement = Input.GetAxis("Horizontal");
            transform.position += new Vector3(horMovement * speed * Time.deltaTime, 0, 0);
        }
    }

move the rigidbody, not the transform, as moving the transform itself causes discontinuities in the physics system

Also, since in the end you’re just applying a speed, I suggest setting RigidBody2D.velocity instead of computing the position. If you really need to compute the position you should probably use RigidBody2D.MovePosition method (which under the hut will compute the velocity to move the rigidbody to that position on the next frame).
Although with this approach keep in mind you’ll need to manually stop the rigidbody (or let friction to do it if you don’t need that level of control)