I'm making a maze game and every time the player hits the wall it slides backwards uncontrollably. How do I prevent this

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
private float speed = 10;
public float rotationSpeed;
private Rigidbody playerRB;

public GameObject projectilePrefab;
public Animator playerAnim;

// Start is called before the first frame update
void Start()
{
    playerRB = GetComponent<Rigidbody>();

}

// Update is called once per frame
void Update()
{
    MovePlayer();

    Shoot();
}

void MovePlayer()
{
    float horizontalInput = Input.GetAxis("Horizontal");
    float verticalInput = Input.GetAxis("Vertical");

    Vector3 movementDirection = new Vector3(horizontalInput, 0, verticalInput);
    movementDirection.Normalize();

    transform.Translate(movementDirection * speed * Time.deltaTime, Space.World);

    if (movementDirection != Vector3.zero)
    {
        //quick change look direction
        //transform.forward = movementDirection;

        //gradual change look direction
        Quaternion toRotation = Quaternion.LookRotation(movementDirection, Vector3.up);
        transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, rotationSpeed * Time.deltaTime);

        playerAnim.SetBool("walking", true);
    }
    else
    {
        playerAnim.SetBool("walking", false);
        
    }
}



private void Shoot()
{
    // Launch a projectile from the player
    if (Input.GetKeyDown(KeyCode.Space))
    {
       
        Arrow arrow = Instantiate(projectilePrefab, transform.position, projectilePrefab.transform.rotation).GetComponent<Arrow>();
        arrow.Setup(gameObject.transform.forward, Vector3.zero);

    }
}

,