How can you apply force or set the velocity of a rigidbidy on local axis?

In Unity is it possible to apply force or set the velocity of a rigidbody on local axis? If so, how can you do it? Thank you for your time.

If you want to add force, you can use AddRelativeForce as mentioned by @Eric5h5 at Addforce in local space? - Questions & Answers - Unity Discussions

If you want to set the velocity you can do this, as mentioned by @aldonaletto at Velocity relative to Local Axis - Questions & Answers - Unity Discussions

   var locVelocity = transform.InverseTransformDirection(rigidbody.velocity);
   locVelocity.z = speed;
   rigidbody.velocity = transform.TransformDirection(locVelocity);