Snake following mouse and moves faster when the mouse is further away

So I haven’t used Unity or CSharp in a year and I got nostalgic and wanted to try to make a snake game. Right now I have two classes, one for the Head, and one for the the Body parts.

Right now the Snake body parts move further away from each other when I move the mouse further away from the snakehead, and move closer to the snakehead when I move the mouse closer to the SnakeHead.

The SnakeBody parts is moving in the exact vector coordinates of the SnakeHead, so that if if the head starts to move faster, so will the body parts as well.

This means that the problem lies in the way the SnakeHead is moving I am pretty sure, but the logic seems fine to me.

 private void moveToMouse() {
        mousePosition = Input.mousePosition;
        mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
        directionToMove = mousePosition - transform.position;

        timer += Time.deltaTime; 
        if (timeBetweenBodyParts < timer) {
            recordPositionList.Insert(0, transform.position);
            timer = 0f; 
        }

        if (recordPositionList.Count > totalSnakeBodyParts) {
            recordPositionList.RemoveAt(recordPositionList.Count-1); 
        }

        Debug.Log(directionToMove.normalized * (speed * Time.deltaTime)); 
        transform.position = transform.position + directionToMove.normalized * (speed * Time.deltaTime);

    }

TLDR: Moving the mouse further away from the head increases the speed of the snakehead, and moving it closer decreases the speed of the snakehead and I don’t want this. I want the same speed of the snakehead regardless.

Gif for visual explanation:

The fault was that Camera.main.ScreenToWorldPoint(mousePosition); returns a Vector3 with a z coordinate making the snake navigate in 3D space. Setting the z compontent of the mouseposition resolved the issue.

mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
mousePosition = new Vector3(mousePosition.x, mousePosition.y, 0); 
directionToMove = mousePosition - transform.position;

This fixed the issue.