If a point in lng and lat is on line Segment or it only 2 meters away

Here is what I am trying to achieve,( please do not put duplicate has I cannot ask questions),I want to find if the point cLng, cLat is on the Segment line aLng,alat to bLng,bLng. My problem is that my distance check is not working at 2.00 meters which is EPSILON.
Any help in improving this code would be much appreciated.

        var crossProduct = (cLat - aLat) * (bLng - aLng) - (cLng - aLng) * (bLat - aLat);
        if (Math.Abs(crossProduct) == 0)
        {
            return true;
        }
        
        var dotProduct = (cLng - aLng) * (bLng - aLng) + (cLat - aLat) * (bLat - aLat);

        var squaredLength = (bLng - aLng) * (bLng - aLng) + (bLat - aLat) * (bLat - aLat);
        

        var param = -1d;
        if (squaredLength != 0) //in case of 0 length line
        {
            param = dotProduct / squaredLength;
        }

        double xx = param < 0 ? aLng : param >  1 ? bLng: aLng + param * bLng - aLng;
        double yy = param < 0 ? aLat : param >  1 ? bLat: aLat + param * bLat - aLat; 
        var dx = cLng - xx;
        var dy = cLat - yy;
        var sqrt = Math.Sqrt(dx * dx + dy * dy);
        return sqrt < EPSILON;