Game object snaps back every time it collides with another object

So I’m making a very simple “pong-like” game to get myself familiar with Unity. I made a simple script to control the platform.

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

public class PlayerController : MonoBehaviour
{
    private Rigidbody rigidBody;
    public float speed = 30.0f;
    // Start is called before the first frame update
    void Start()
    {
        rigidBody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {
        float horizontalInput = Input.GetAxis("Horizontal");
        rigidBody.velocity = Vector3.right * speed * horizontalInput;
    }
}

Then I add two barriers with colliders and rigid bodies to the left and right and freeze them in position. Now when I move the platform to the left or right the barriers block its movement. But instead of the platform stopping on the barriers it bounces back and it always bounces back the same distance, no matter what the velocity is. Continues colliding causes this weird jittery effect that doesn’t look good.

I used transform.Translate() before but I don’t like that I manually have to write down the borers in code. Plus then the barriers don’t really do anything and are just there for visuals. I also don’t like AddForce() because inertia is a real problem. Also I think it has the same problem with jitteriness.
Thanks in advance.

if you add in a magnitude check you can decrease jitter. I think I might need to see a video to figure out the other issue. I think there is also a rounding and other features built in for this.

float horizontalInput = Input.GetAxis("Horizontal");
//add here
if(horizontalInput<.1f&&horizontalInput>-.1f)
    horizontalInput=0;    
//to here
rigidBody.velocity = Vector3.right * speed * horizontalInput;