Prevent increasing velocity if exceeding speed

I’m fairly new to Unity, and am trying to implement custom player movement, which is working fine, except I’m a little stumped around max velocity handling.

I’m not using AddForce to my rigidbody, instead just adjusting the velocity, as it provides movement closer to what I’m aiming for.
At first, using if (velocity.magnitude > maxSpeed) worked fine, but now I’m running into issues where I want external forces (explosions, general knockback) are also limited.

The first thing that came to mind was prevent input if at maxSpeed, but this runs into a lot of issues with 3D rotational movement where you now can’t drag the character in the opposite direction (cause input is disabled over x speed).

Does anyone have any ideas how to get around this?

// not the actual code, but essentially what I'm doing
if (Input.GetKey(forward))
else if (Input.GetKey(backward))

if (velocity.magnitude > maxSpeed)
    velocity = velocity.normalized * maxSpeed;

Sovled by making the velocity radial, e.g. the player can move at any velocity, but when using input movement, if the current velocity is larger than maxSpeed, keep the velocity magnitude the same but allow for directional shift