My Character is moving fine horizontally and vertically, but moves way too fast diagonally

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour {

    public float moveSpeed;

    private Animator anim;

    private bool PlayerMoving;

    private Vector2 LastMove;

    private Rigidbody2D myRigidBody;
    
    // Use this for initialization
	void Start () {
        myRigidBody = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
	}
	
	// Update is called once per frame
	void Update () {

        PlayerMoving = false;

        if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f )
        {
            // transform.Translate  (new Vector3(Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
            myRigidBody.velocity = new Vector2(Input.GetAxisRaw("Horizontal"), myRigidBody.velocity.y) * moveSpeed;
            PlayerMoving = true;
            LastMove = new Vector2(Input.GetAxisRaw("Horizontal"), 0f);
        }


        if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
        {
            // transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
            myRigidBody.velocity = new Vector2(myRigidBody.velocity.x, Input.GetAxisRaw("Vertical")) * moveSpeed;
            PlayerMoving = true;
            LastMove = new Vector2(0f, Input.GetAxisRaw("Vertical"));
        }

        if (Input.GetAxisRaw("Horizontal") < 0.5f && Input.GetAxisRaw("Horizontal") > -0.5f) 
        {
            myRigidBody.velocity = new Vector2(0f, myRigidBody.velocity.y);
                }

        if (Input.GetAxisRaw("Vertical") < 0.5f && Input.GetAxisRaw("Vertical") > -0.5f) 

        {
            myRigidBody.velocity = new Vector2(myRigidBody.velocity.x, 0f);
        }
            anim.SetFloat("moveX", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat("moveY", Input.GetAxisRaw("Vertical"));
        anim.SetFloat("LastMoveX", LastMove.x);
        anim.SetFloat("LastMoveY", LastMove.y);
        anim.SetBool("PlayerMoving", PlayerMoving);
    }
}

Use a temporal Vector3 to store the velocity. At the end of the Update, set the real velocity to:
tmpVelocity.normalized * moveSpeed;

Make a local Vector3 variable called “velocity”. instead of setting myRigidBody.velocity in the first two if statements, set the x and y values of velocity instead, and -don’t- multiply it by rotation speed.

Finally before setting myRigidBody.velocity, use Vector3.ClampMagnitude to clamp the total of the vector to 1.

Here’s an example, please note that I left out the other parts of the code as they are not related to the answer. Also I’m using Mathf.Abs for clarity, instead of two if statements, though this is not essential:

void Update()
{
	var velocity = new Vector3();

	if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) > 0.5f)
	{
		velocity.x = Input.GetAxisRaw("Horizontal");
	}

	if (Mathf.Abs(Input.GetAxisRaw("Vertical")) > 0.5f)
	{
		velocity.y = Input.GetAxisRaw("Vertical");
	}

	// This is where the magic happens
	velocity = Vector3.ClampMagnitude(velocity, 1) * moveSpeed;
}