Rotation changing in untouched axis

Somehow, when changing in x and y axis, z axis is also changed.
I can’t sleep because of this, I really cant understand the problem.

I tried the Transform.Rotate method and also by calculating the resulting quaternions to check if it was a bug with the method or something but the result is the same.

    Vector3 newHeadRotationDelta = Vector3.zero;
            newHeadRotationDelta += Vector3.up * xInput * mouseSensibility * Time.deltaTime;
            newHeadRotationDelta += Vector3.left * yInput * mouseSensibility * Time.deltaTime;

    var newQuat = headObj.localRotation * Quaternion.Euler(newHeadRotationDelta);
    headObj.localRotation = newQuat;

If someone can help me figure it out, I’d be much appreciated, this is driving me crazy.

Thanks

EDIT: Added more code for clarity

There is a very easy answer to your question.
First make your camera in the scene a child of your player.
Instead of changing the rotation of your player in both the axes just change Vertical rotation of your camera and the horizontal rotation of your Player separately.like:-

void Update()
    {
        if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
            Cursor.lockState = CursorLockMode.None;
        transform.position = offset + plr.position;
        float y = Input.GetAxis("Mouse Y") * mousesensitivity * Time.deltaTime;
        float x = Input.GetAxis("Mouse X") * mousesensitivity * Time.deltaTime;
        xRotation -= y;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);
        transform.localRotation = Quaternion.Euler(xRotation, x, 0f);
        plr.Rotate(Vector3.up * x);
        
    }