How to keep the object height when rotating around?

This code is working nice but the object that rotate around is moving towards the target (objectToRotateAround) and therefore changing height depending on the radius.

I want to keep this script as it is but to add a feature with a flag bool variable name keepHeight and if it’s false make the script act like now as it is but if it’s true I want that when starting the game or at runtime when changing the radius that the object will move to the new radius at the same height it is currently and also to rotate around at the same height.

I think I should change/add something in the ApplyRadius method but not sure how and what to do.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static UnityEngine.GraphicsBuffer;

public class RotateAroundPoint : MonoBehaviour
{
    public Transform objectToRotateAround;
    public Vector3 axis;
    public float rotationSpeed;
    public float moveToRadiusSpeed;
    public bool keepHeight;
    [SerializeField] private float radius;

    private float lastRadius;

    private void Start()
    {
        ApplyRadius();
    }

    private void Update()
    {
        if (!Mathf.Approximately(radius, lastRadius))
        {
            ApplyRadius();
        }

        transform.RotateAround(objectToRotateAround.position, axis, rotationSpeed * Time.deltaTime);
    }

    private void ApplyRadius()
    {
        Vector3 direction = (transform.position - objectToRotateAround.position).normalized;
        Vector3 targetPosition = objectToRotateAround.position + direction * radius;

        float step = moveToRadiusSpeed * Time.deltaTime;
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, step);

        if (Mathf.Abs(radius - lastRadius) < 0.001f)
        {
            transform.position = targetPosition;
            lastRadius = radius;
        }
    }
}