Please help my parallax background is getting broken

I’m making a top down spaceship game and I’ve added a parallax star background. The spaceship can warp (basicly moving at an insane speed) and I’ve made it so when it does the camera size increases and the background becomes bigger and the background moves faster than normal (done it because of the rescaling) but for some reason when the player stops warping the background continues going forward (even faster) and then it slowly returns to the camera. I’ve tried preventing that by telling the background to teleport to the camera coords when the ship stops moving but it doesn’t change anything. Please help. Would be great if you can actually tell me a better solution for the increasing of speed of the background (decreasing the parallax effect).
Here are the scripts:

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

public class Controller : MonoBehaviour
{
    [SerializeField] private float maxSpeed;
    private float speed;
    [SerializeField] private float acceleration;
    [SerializeField] private float turnSpeed;
    [SerializeField] private float warpMaxSpeed;
    [SerializeField] private float warpAcceleration;
    public float warpSpeed;
    private bool isWarping;
    private Rigidbody2D rb;
    private PlayerInputActions playerInputActions;

    void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
        playerInputActions = new PlayerInputActions();
        playerInputActions.Player.Enable();
    }

    void FixedUpdate()
    {
        if (isWarping)
        {
            warpSpeed += warpAcceleration * Time.deltaTime;
            if (warpSpeed > warpMaxSpeed) warpSpeed = warpMaxSpeed;
            rb.velocity = transform.right * warpSpeed;
        }
        else if (warpSpeed > 0)
        {
            warpSpeed -= warpAcceleration * 5 * Time.deltaTime;
            if (warpSpeed < 0) warpSpeed = 0;
            rb.velocity = transform.right * warpSpeed;
        }
        else
        {
            Vector2 input = playerInputActions.Player.Move.ReadValue<Vector2>();
            speed += input.y * acceleration * Time.deltaTime;
            if (speed > maxSpeed) speed = maxSpeed;
            else if (speed < 0) speed = 0;
            rb.velocity = transform.right * speed;
            transform.Rotate(0f, 0f, -input.x * turnSpeed * Time.deltaTime);
        }
    }
    
    //Gets activated from Player Input component using unity events
    public void Warp(InputAction.CallbackContext context) => isWarping = context.performed;
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Parallax : MonoBehaviour
{
    private float lenghtX;
    private float startLenghtX;
    private float lenghtY;
    private float startPosX;
    private float startPosY;
    [SerializeField] private Transform cam;
    [SerializeField] private float parallaxEffect;
    [SerializeField] private float parallax;

    void Awake()
    {
        startPosX = transform.position.x;
        startPosY = transform.position.y;
        parallax = parallaxEffect;
        startLenghtX = GetComponent<SpriteRenderer>().bounds.size.x;
    }

    void FixedUpdate()
    {
        cam.GetChild(0).localScale = new Vector3(cam.GetComponent<Camera>().orthographicSize / 20 / cam.GetComponent<CameraFollowPlayer>().target.localScale.x, cam.GetComponent<Camera>().orthographicSize / 20 / cam.GetComponent<CameraFollowPlayer>().target.localScale.x, cam.transform.GetChild(0).localScale.z);
        if (cam.GetComponent<CameraFollowPlayer>().target.GetComponent<Rigidbody2D>().velocity.magnitude > 0 || cam.GetComponent<CameraFollowPlayer>().target.GetComponent<Controller>().warpSpeed > 0)
            parallax = parallaxEffect / cam.GetComponent<CameraFollowPlayer>().target.GetComponent<Rigidbody2D>().velocity.magnitude;
        else parallax = parallaxEffect;
        lenghtX = GetComponent<SpriteRenderer>().bounds.size.x;
        lenghtY = GetComponent<SpriteRenderer>().bounds.size.y;
        float tempX = (cam.position.x * (1 - parallax));
        float tempY = (cam.position.y * (1 - parallax));
        float distX = (cam.position.x * parallax);
        float distY = (cam.position.y * parallax);
        transform.position = new Vector3(startPosX + distX, startPosY + distY, transform.position.z);
        if (tempX > startPosX + lenghtX) startPosX += lenghtX;
        else if (tempX < startPosX - lenghtX) startPosX -= lenghtX;
        if (tempY > startPosY + lenghtY) startPosY += lenghtY;
        else if (tempY < startPosY - lenghtY) startPosY -= lenghtY;
    }
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CameraFollowPlayer : MonoBehaviour
{
    [SerializeField] private bool rotateWithPlayer;
    [SerializeField] private float directionalOffset;
    [SerializeField] private Vector3 offset;
    [SerializeField] public Transform target;
    [SerializeField] private bool smoothFollow;
    [SerializeField] private float smoothSpeed;
    [SerializeField] private bool velocityFOV;
    [SerializeField] private float speedFOV;

    void FixedUpdate()
    {
        if (target == null) return;
        if (rotateWithPlayer) transform.rotation = Quaternion.Euler(0f, 0f, target.eulerAngles.z + directionalOffset);
        Vector3 desiredPos = new Vector3(target.position.x + offset.x, target.position.y + offset.y, transform.position.z);
        if (!smoothFollow) transform.position = desiredPos;
        if (smoothFollow) transform.position = Vector3.Lerp(transform.position, desiredPos, smoothSpeed);
        Vector2 targetVelocity = target.GetComponent<Rigidbody2D>().velocity;
        if (velocityFOV && (targetVelocity.magnitude > 1000 || target.GetComponent<Controller>().warpSpeed > 0)) GetComponent<Camera>().orthographicSize = 20 * target.localScale.x + target.localScale.x * targetVelocity.magnitude * speedFOV;
        else GetComponent<Camera>().orthographicSize = 20 * target.localScale.x;
    }
}