Read through Find projection point on elipse where the answer goes over the 2D case of projecting a point $\textbf{p}$ onto an ellipse defined by $\textbf{x}(t) = \textbf{c} + \textbf{u}\cos(t) + \textbf{v}\sin(t)$ where $\textbf{c}$ is the center of the ellipse, $\textbf{u}$ is the vector that defines the length and direction of one of the semi major/minor axis and $\textbf{v}$ defines the length and direction of the other semi major/minor axis. Both of which are orthogonal to each other. The equation below is derived from the relationship $(\textbf{x}(t) - \textbf{p}) \cdot\textbf{x}'(t) = 0$ $$C_1\cos(t) + C_2\sin(t) + C_3\sin(2t) = 0$$ where $$C_1 = (\textbf{c} - \textbf{p})\cdot \textbf{v}, C_2 = (\textbf{p} - \textbf{c})\cdot \textbf{u}, C_3 = \frac{1}{2}(\textbf{u}\cdot \textbf{u} - \textbf{v}\cdot \textbf{v})$$
It seems this equation which is claimed to have 4 roots at most (when solving for t) is solved best when you have a fixed ellipse with actual numbers and are trying to solve it with a Computer Algebra System for a specific case of an ellipse. Trying to solve this symbolically to get the generalization gives very lengthy equations (tried in Mathematica).
I need this for some 3D code where the position and form of my ellipse is dynamic so $\textbf{c}, \textbf{u}, \textbf{v}$ can change rapidly. So what do I do? I tried Numerical Methods such as the Newton-Raphson but I have no clue how to get all 4 roots (if there are any) all the time. Without all 4, you cannot check for the closest using $||\textbf{x}(t_i) - \textbf{p}||_2$. Any help would be appreciated on the direction to take, if I'm misunderstanding something, any assumptions are incorrect, etc.
There's also this paper "Least-squares orthogonal distances fitting of circle, sphere, ellipse, hyperbola, and parabola" by Sung Joon Ahn, et. al., but I'm not mathematically mature enough to read this quite yet.