We analytically work out the long-term variations caused on the motion of a planet orbiting a star by a distant, pointlike massive object X (Planet X/Nemesis/Tyche). It turns out that, apart from the semimajor axis $a$, all the other Keplerian orbital elements of the perturbed planet experience long-term variations which are complicated functions of the orbital configurations of both the planet itself and of X. A numerical integration of the equations of motion of the perturbed planet yielding the temporal evolution of all its orbital elements successfully confirms our analytical results. We infer constraints on the minimum distance $d_{\rm X}$ at which the putative body X can exist by comparing, first, our prediction of the long-term variation of the longitude of the perihelion $\varpi$ to the latest empirical determinations of the corrections $\Delta\dot\varpi$ to the standard Newtonian/Einsteinian secular precessions of several planets of the solar system recently obtained. Independent teams of astronomers estimated them by fitting accurate dynamical force models$-$not including the action of X itself$-$to observational data records covering almost one century. Then, we numerically compute the perturbations induced by X on the range $\rho$, the right ascension $\alpha$ and the declination $\delta$ of Saturn. We compare them with the latest residuals produced by analyzing records of radiotechnical data from the Cassini spacecraft spanning some years. Tighter constraints on $d_{\rm X}$ are, thus, obtained. The combined use of all the methods adopted yield the following lower bounds on $d_{\rm X}$ for the assumed masses of X quoted in brackets: $141-281$ au (Mars), $300-600$ au (Earth), $771-1542$ au (Neptune), $2037-4074$ au (Jupiter), $8784-17568$ au (brown dwarf with $m_{\rm X}=80\ m_{\rm Jup}$), $16434-32868$ au (red dwarf with $m_{\rm X}=0.5\ {\rm M}_{\oplus}$), $20709-41418$ au (Sun). Alternative strategies which could be followed are pointed out. Constraints on the adimensional parameter $-q$ of the External Field Effect within the MOdified Newtonian Dynamics are obtained from the range residuals of Saturn: it turns out $-q\approx 0.01-0.04$ (at $1/3-\sigma$ level of rejection).