The points equally distant to a point form a sphere in 3D with equation: $$x^2+y^2+z^2=r^2$$
Now say that I have two points $A(x_1,y_1,z_1), B(x_2, y_2, z_2)$ that are on a line with equation: $$x=x_0+ta\\y=y_0+tb\\z=z_0+tc$$
What would be the equation for the points equally distant to the line segment? It should look like a pill (a cylinder with a hemisphere at either end), but I don't know how to describe it mathematically.

First form the unit vector from $A$ to $B$. This is given by
$ N = \dfrac{B - A}{\| B - A \| } $
Second, find any vector in $3D$ that is perpendicular to $N$, let's call it $V_1$.
Third, compute the vector $V_2 = N \times V_1 $
Now the desired locus of the points that are at the same distance $r$ from the segment $AB$ is the union of three regions in space: region $R_1$ given by
$ R_1 = \{ (x, y, z) | (x, y, z) = (1 - t) A + t B + r V_1 \cos s + r V_2 \sin s , 0 \le t \le 1, 0 \le s \le 2 \pi \} $
and region $R_2$ given by
$ R_2 = \{ (x, y, z) | (x, y, z) = A + r ( \sin t \cos s \ V_1 + \sin t \sin s \ V_2 - \cos t \ N ) , 0 \le t \le \pi , 0 \le s \le 2 \pi \} $
and region $R_3$ given by
$ R_3 = \{ (x, y, z) | (x, y, z) = B + r ( \sin t \cos s \ V_1 + \sin t \sin s \ V_2 + \cos t \ N ) , 0 \le t \le \pi , 0 \le s \le 2 \pi \} $