To solve problems like this you take the following steps:
- Position Kinematics - Take the position of the particle and parameterized it such that it always obeys the constraint.
In this example, the position of point A described by a vector $\boldsymbol{r}_A$ is found using spherical coordinates originating from point B described by the vector $\boldsymbol{r}_B$.
$$\boldsymbol{r}_A (\varphi,\psi) = \boldsymbol{r}_B + \pmatrix{R \cos \varphi \cos \psi \\ R \sin \varphi \cos \psi \\ R \sin \psi} \tag{1} $$ where $R = \| \boldsymbol{r}_A - \boldsymbol{r}_B \|$ is the fixed distance, and $\varphi$, $\psi$ the varying parameters.
- Velocity Kinematics - Take the time derivative of the position, assuming the motion of B is known. For example $\boldsymbol{v}_B =0$. Use the chain rule to evaluate each component (for example $\frac{\rm d}{{\rm d}t} \cos \varphi = (-\sin \varphi) \dot{\varphi}$ and so on), in terms of the parameter derivatives $\dot \varphi$ and $\dot \psi$.
$$\require{cancel} \boldsymbol{v}_A = \cancelto{0}{ \boldsymbol{v}_B} + \pmatrix{-R \dot\varphi \sin \varphi \cos \psi - R \dot \psi \cos \varphi \sin\psi \\ R \dot\varphi \cos\varphi \cos\psi - R \dot \psi \sin\varphi \sin \psi \\ R \dot \psi \cos \psi } \tag{2} $$
- Acceleration Kinematics - Similarly take the time derivative of (2) to get to acceleration. Again using the chain rule as if $\varphi$ and $\dot \varphi$ were independent (for example $\frac{{\rm d}}{{\rm d}t} \dot\varphi \cos \varphi = \ddot \varphi \cos \varphi + \dot \varphi (-\dot \varphi \sin \varphi) $ and so on).
$$ \boldsymbol{a}_A = \pmatrix{-R \left( \cos \varphi ( \ddot \psi \sin\psi + (\dot \varphi^2+ \dot \psi^2) \cos\psi ) + \sin \varphi ( \ddot \psi \cos\psi -2 \dot \varphi \dot \psi \sin \psi ) \right) \\ R \left( \cos \varphi ( \ddot \varphi \cos\psi + 2 \dot \varphi \dot \psi \sin\psi ) - \sin \varphi ( \ddot \psi \sin\psi +( \dot \varphi^2 + \dot \psi^2) \cos \psi ) \right) \\ R \left( \ddot \psi \cos \psi - \dot \psi^2 \sin \psi \right) } \tag{3}$$
- Global → Local Transformations - Yikes, nobody said this is going to be easy. But things improve a bit when the above acceleration vector is transformed along the local coordinate system, with 1st direction radially out $\boldsymbol{\hat{r}} = \pmatrix{ \cos \varphi\cos \psi \\ \sin\varphi \cos\psi \\ \sin\psi }$, the 2nd direction tangentially around $\boldsymbol{\hat \varphi} = \pmatrix{-\sin \varphi \\ \cos \varphi \\ 0}$ and the 3rd direction tangentially toward the poles $\boldsymbol{\hat \psi} = \pmatrix{\cos\varphi \sin\psi \\ -\sin \varphi \sin\psi \\ \cos \psi}$
The above kinematics in local coordinates (denoted with $\star$) are
$$ \boldsymbol{r}_A^\star = \boldsymbol{r}_B^\star + \pmatrix{ R \\ 0 \\ 0} \tag{4}$$
$$ \boldsymbol{v}_A^\star = \pmatrix{ 0 \\ R \dot \varphi \cos \psi \\ R \dot \varphi } \tag{5}$$
$$ \boldsymbol{a}_A^\star = \pmatrix{ -R ( \dot \varphi^2 \cos^2 \psi + \dot \psi^2) \\ R ( \ddot \psi \cos \psi - 2 \dot \varphi \dot \psi \sin \psi) \\ R ( \ddot \psi + \dot \varphi^2 \sin\psi \cos\psi) } \tag{6} $$
- Equations of motion - Apply $\boldsymbol{F}^\star = m \boldsymbol{a}_A^\star$ for the particle along the local coordinate system
$$ \pmatrix{ F_r \\ F_\varphi \\ F_\psi } = m \pmatrix{ -R ( \dot \varphi^2 \cos^2 \psi + \dot \psi^2) \\ R ( \ddot \psi \cos \psi - 2 \dot \varphi \dot \psi \sin \psi) \\ R ( \ddot \psi + \dot \varphi^2 \sin\psi \cos\psi) } \tag{7}$$
- Motion Solution - Given known tangential forces $F_\varphi$ and $F_\psi$ find the unknown radial "normal" force $F_r$ and the acceleration of the particle. Use (7) to find
$$ \begin{aligned} F_r & = -R m (\dot \varphi^2 \cos^2 \psi+ \dot \psi^2) \\ \ddot \varphi & = \frac{F_\varphi}{m R \cos \psi} + 2 \dot \varphi \dot \psi \tan \psi \\ \ddot \psi & = \frac{F_\psi}{m R} - \dot \varphi^2 \sin\psi \cos\psi \end{aligned} \tag{8} $$
Plug the parameter acceleration values $\ddot \varphi$ and $\ddot \psi$ into (3) or (6) to get the acceleration vector in cartesian coordinates. Most likely (8) is really an Ordinary Differential Equation with two parameters, and you can simulate the solution using an ODE solver.