How to get the length of a curve?

someone in blender chat was going down that path with far more math than I can comprehend. They almost have it working but needed to sleep on it after they were like 95% there. Sometimes the half sphere still rotates away from being aligned with the edge rings of the tube while they are editing the curve, breaking the merge by distance.

I have decided to stick with my approach of merging a sphere with a cylinder and then using curve deformer.