Camera jitters when getting up from croutch

I’m making a crouch mechanic for an fps game and mechanically it works well enough, but when I exit crouching the camera jitters a bit because the entire charactercontroller jitters. How can I make this smooth?

if (isCrouching)
            {
                characterController.height = Mathf.Lerp(characterController.height, 1.0f, Time.deltaTime * crouchTransitionDuration);
                characterController.center = Vector3.Lerp(characterController.center, new Vector3(0, 0.5f, 0), Time.deltaTime * crouchTransitionDuration);


                transform.position = new Vector3(transform.position.x, transform.position.y - 5f, transform.position.z);
            }
            else
            {
                characterController.height = Mathf.Lerp(characterController.height, 2.0f, Time.deltaTime * crouchTransitionDuration);
                characterController.center = Vector3.Lerp(characterController.center, new Vector3(0, 0, 0), Time.deltaTime * crouchTransitionDuration);


                transform.position = new Vector3(transform.position.x, transform.position.y + 5f, transform.position.z);
            }

You need to make the camera and physics separate.
You can create a player’s object, put a collider into it, separately create a camera object (these 2 objects are children of the player). Then calculate the point where the camera should be located and do
camera.localpos = Vector3.Lerp (camera.localpos, localCamraPoint, time * Time.deltaTime).