You don't need to rewrite these methods, as there are already equivalent methods built-in.
For example, to get the distance between two 3-dimensional vectors, you can use Vector3.Distance
(Unity entry)
float distance = Vector3.Distance(someVector, anotherVector);
If you want to find the two closest points, you should be able to accomplish this using other vector methods as well.
Here is an example of how to use the methods to find the closest points on two difference lines (taken from the Unity wiki). It still uses the determinants to calculate this. For an explanation of why this works, you need to understand basic linear algebra for vectors.
//Two non-parallel lines which may or may not touch each other have a point on each line which are closest
//to each other. This function finds those two points. If the lines are not parallel, the function
//outputs true, otherwise false.
public static bool ClosestPointsOnTwoLines(out Vector3 closestPointLine1, out Vector3 closestPointLine2, Vector3 linePoint1, Vector3 lineVec1, Vector3 linePoint2, Vector3 lineVec2){
closestPointLine1 = Vector3.zero;
closestPointLine2 = Vector3.zero;
float a = Vector3.Dot(lineVec1, lineVec1);
float b = Vector3.Dot(lineVec1, lineVec2);
float e = Vector3.Dot(lineVec2, lineVec2);
float d = a*e - b*b;
//lines are not parallel
if(d != 0.0f){
Vector3 r = linePoint1 - linePoint2;
float c = Vector3.Dot(lineVec1, r);
float f = Vector3.Dot(lineVec2, r);
float s = (b*f - c*e) / d;
float t = (a*f - c*b) / d;
closestPointLine1 = linePoint1 + lineVec1 * s;
closestPointLine2 = linePoint2 + lineVec2 * t;
return true;
}
else{
return false;
}
}