Find the furthest GameObject in an array C#

How do you find the furthest GameObject in an array. I know how to find the closets:

GameObject FindLastWaypoint()
	{
    	WayPoints = GameObject.FindGameObjectsWithTag("Waypoint");
        GameObject closest = null;
        float distance = Mathf.Infinity;
        Vector3 position = transform.position;
		
        foreach (GameObject item in WayPoints) 
		{
            Vector3 diff = item.transform.position - position;
            float curDistance = diff.sqrMagnitude;
			
            if (curDistance < distance) 
			{
                closest = item;
                distance = curDistance;
            }
        }
        return closest;
    }

But I can’t find the furthest! HELP!!

Never mind got it!

“Vector3 diff = item.transform.position - position;” Instead of " - position" it was " + position"!

Do that in reverse!

float dist = 0;

foreach (…) {
if (curDist > dist) {
furthest = item;
dist = curDist;
}
}

        Vector3 pos = transform.position;
        GameObject closestObject = GameObject.FindGameObjectsWithTag("Waypoint").OrderByDescending(o => Vector3.Distance(o.transform.position, pos)).FirstOrDefault();

I am not saying it is better. It’s just a different way of thinking about it.