Stop Y velocity without releasing key?

Hi, I’ve been at this for a while. What I’m trying to do seems simple. What I have is an object descending by holding down a key with a raycast that detects when it’s a certain distance from the ground. Then have a boolean turning that ability off. But it keeps descending if I keep the key pressed. Unless I let go of the key it’ll keep going. Does anyone know how to stop JUST the Y velocity without releasing the key?

Simple-

if(!hasReachedBottom && Input.GetKey("D"))
{
    // Descend!

    if(I've hit the bottom, however you determine that)
    {
        hasReachedBottom = true;
    }
}