Projectile shooting with custom force

Hi. I have made a projectile shooting system. I want to shoot an object from position A to B following an indicated path. Everything is working fine except for one thing. The velocity applied on the object is calculated based on the distance between A and B, the value of time is 1 to travel this distance. Meaning that the farther I hit, the quicker it goes. I want to have control of the force applied. Meaning that it should go with my set speed whether I hit near or far.

 Vector3 calculateVelocity(Vector3 target, Vector3 origin, float time)
    {
        Vector3 distance = target - origin;
        Vector3 distanceXZ = distance;
        distanceXZ.y = 0f;

        float Sy = distance.y;
        float Sxz = distanceXZ.magnitude;
        float Vxz = Sxz / time;
        float Vy = 0f;
        
        Vy = Sy / time + 0.5f * Mathf.Abs(Physics.gravity.y) * time;
       
        Vector3 result = distanceXZ.normalized;
        result = result * Vxz;
        result.y = Vy;

        return result;
    }

If you want to just give it a set speed all the time just apply that velocity to the rigidbody by getting the direction, normalizing it and then multiplying by speed:

Vector3 targetDir = target.position - origin.position;

//use this
Vector3 velocity = targetDir.normalized * speed;