Setting up a proper state machine

Hi everyone after watching lots of youtube and googling about 10,000 things I’m a little confused on state machines. On the code below, I am unsure how to break out of states and go into other states when it comes to my movement script.

If I initiate PlayerMovement() on my idle state to enable walking, it just switches to State.Moving then completely stops my character’s ability to move.

protected virtual void Update()
    {
        IframeAnimation();
        GatherMovementData();

        switch (state)
        {
            case State.Idle:
                break;

            case State.Moving:
                Dash();
                ActivateAttack();
                MovementAnimation();
                break;
        }

    }
    protected virtual void FixedUpdate()
    {
        switch (state)
        {

            case State.Moving:
            StartCoroutine(PlayerMovement());
                break;
        }
    }
    private IEnumerator PlayerMovement()
    {
        state = State.Moving;

        if (isAlive && !Input.GetKey(KeyCode.Space) && knockedBack == false)
        {
            rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime);
        }

        if (!isAlive)
            yield return new WaitForSeconds(0f);

       
    }

bump

It might be helpful to examine how others have approached this problem. A github search pulled up:
https://github.com/minhhh/unity-fsm
https://github.com/thefuntastic/Unity3d-Finite-State-Machine
https://github.com/dubit/unity-fsm

They may be more abstract than the concrete AI behavior you want, so the task would be to imagine how your behaviors could fit into such a system. Hope that helps.