You can use the transform for this. I'm assuming you're in 2D, but the principle is the same in 3D.
In 2D transform.x
is the object's local forward axis. So to always move forward regardless of rotation, you could do this for example:
func _process(delta):
if Input.is_action_pressed("forward"):
position += transform.x * speed * delta