Then how are you given the line? Are you given angles or are you given the coordinates of the point where it crosses the sphere?
I would use spherical coordinates: For a sphere of radius R, centered at [itex](x_0, y_0, z_0)[/itex], [itex]x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0[/itex], [itex]y= \rho cos(\theta)sin(\phi)+ y_0[/itex], [itex]z= \rho cos(\phi+ z_0[/itex].
If the line is designated by angles [itex]\theta[/itex] and [itex]\phi[/itex], just replace [itex]\rho[/itex] by R+ d.
If you are told that the line crosses the sphere at [itex]\left(x_1, y_1, z_1\right)[/itex] then you can use [itex]x_1-x_0= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0[/itex], [itex]y_1-y_0= \rho cos(\theta)sin(\phi)+ y_0[/itex], [itex]z_1-z_0= \rho cos(\phi)[/itex] to find [itex]\theta[/itex] and [itex]\phi[/itex].
Dividing the second equation by the first, [itex](y_1-y_0)/(x_1-x_0)= sin(\theta)/cos(\theta)= tan(\theta)[/itex] so [itex]\theta= tan^{-1}(y_1-y_0)/(x_1-y_0)[/itex]. Also [itex](x_1-x_0)^2+ (y_1-y_0)^2= \rho^2 cos^2(\theta)sin^2(\phi)+ \rho^2 sin^2(\theta)sin^2\phi= \rho^2sin^2\phi[/itex] and [itex]\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}= \rho sin \phi[/itex] while [itex]z_1- z_0= \rho cos\phi[/itex] so [itex]\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1-z_0)= sin\phi/cos\phi= tan\phi[/itex]. [itex]\phi= tan^{-1}\sqrt{(x_1-x_0)^2+ (y_1-y_0)^2}/(z_1- z_0)[/itex].
Now use [itex]x= \rho cos(\theta)sin(\theta)sin(\phi)+ x_0[/itex], [itex]y= \rho cos(\theta)sin(\phi)+ y_0[/itex], [itex]z= \rho cos(\phi)[/itex] with those values of [itex]\theta[/itex] and [itex]\phi[/itex] and [itex]\rho= R+ d[/itex].