Camera movement feels weird

I am creating a camera control script, it works fine but when moving horizontally it feels like it slows sometimes.

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

public class CameraControl : MonoBehaviour
{
    public Transform player;
    public float distance = 3f;
    public float sensitivity = 10f;

    private Vector3 offset;
    private float playerHeight;

    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
        if (player)
        {
            playerHeight = player.GetComponent<PlayerControl>().height;

            offset = new Vector3(player.position.x, player.position.y + playerHeight, player.position.z - distance);
        }
    }

    private void LateUpdate()
    {
        if (player)
        {
            Vector3 xOffset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * sensitivity, Vector3.up) * offset;
            Vector3 yOffset = Quaternion.AngleAxis(Input.GetAxis("Mouse Y") * sensitivity, Vector3.right) * offset;

            if (yOffset.y > playerHeight + distance)
            {
                yOffset.y = playerHeight + distance;
            }
            else if (yOffset.y < 0)
            {
                yOffset.y = 0;
            }

            offset = new Vector3(xOffset.x, yOffset.y, xOffset.z);

            transform.position = player.position + offset;

            transform.LookAt(player.position + new Vector3(0f, playerHeight / 2, 0f));
            Debug.Log(Input.GetAxis("Mouse Y"));
        }
    }
}

It’s highly appreciated if you can help me.

Ill admit I didnt look too hard at the code, but just quick question, Have you tried changing LateUpdate to FixedUpdate? if not can you try that and see if that helps.

Instead of creating a script for the camera movement/controller, I used a unity package called cinemachine, which is faster and has high functionality.