How to stop an object straight after key press

Hi all, at the moment I’m making a 2d top down space shooter and I’m using Transform.Translate and I seem to be getting “drift” where after I press a key, the ship moves in that direction but doesn’t stop exactly on when I release the button, I would like a small amount of this “drift” but not as much as I’m getting right now. Is there any way to change this? My code example is below of what I’m doing.

//move right
if (Input.GetAxis(“Horizontal”) > 0)
{
Flip(); //determine which way the ship is facing and rotate the object to that direction
transform.Translate(Vector3.right * Time.deltaTime * speed, Space.World); //move object in the right direction
}

instead of Input.GetAxis(“Horizontal”) you can use Input.GetRawAxis(“Horizontal”) which means that no smoothing will be applied to your movement in other words the character will stop moving as soon as you let go of the key.