distance from centers < sum of radii
its pure geometry, the code is simple. you can eliminate the sqrt and work with distance squared instead of distance with minor modifications to the standard geometry, which is faster, and x1*x1 is faster than pow(x,2). I say that because 99% of these problems are about millions of spheres and efficiently solving large problems.
Write the positions of the centres of the two moving spheres as a function of time t.
Write the distance (squared) between these centres and set it equal to the sum of radii (squared). This will give you a quadratic in t.
If the quadratic has no roots (or only negative roots) then they don't collide in positive time. Otherwise, the smallest positive root will give the collision time.
Well, if YOU wrote that then you clearly wouldn't have any difficulty detecting a collision, would you? But I should do that first - as explained in my last post. Then you'll know when and where the spheres are when they collide.
There's no point in having both moving and static sphere routines - the latter is just a special case with velocity zero.