How to change window sizes of split screen from user input

I have 2 windows open on an app (split screen) which I have accomplished by changing the view port values of the camera to 0.5. I am trying to make it so the user can slide the windows up and down to one side bigger and as a result, the other smaller with the width always being the same.

I have attempted to do this by stretching out a scrollbar across the screen and changing the cam.rect value but it is a very ugly looking and while one panel gets smaller, the opposing panel does not get larger. Here is what I have so far

[SerializeField] private Camera cam;
[SerializeField] private Scrollbar slider;

    Camera ARcam = GameObject.Find("ARCamera").GetComponent<Camera>();
    float value = slider.value;

    Debug.Log(value);

    if (value < 0.1)
    {
        cam.rect = new Rect(0, 0.1f, 1, 0.9f);      //x, y, width, height     bot left is 0,0
        ARcam.rect = new Rect(0, 0, 1, 0.1f);
    }
    else if(value > 0.8)
    {
        cam.rect = new Rect(0, 0.8f, 1, 0.2f);      // top panel
        ARcam.rect = new Rect(0, 0, 1, 0.8f);       // bot panel
    }
    else
    {
        cam.rect = new Rect(0, value, 1, 1-value);
        ARcam.rect = new Rect(0, 0, 1, value);
    }

I am trying to have the slider between the screens to move them up and down

This is what I currently have

Update:

Since the slider moves with the increasing screen size and it cannot be overlaid across the split screens, I am now using a button and trying to measure the distance dragged and move the window accordingly. It is still very choppy though and the width gets scaled too for some reason.