Start by writing down a formula for the electrostatic potential $V(\rr)=V(x,y,z)$ everywhere in space due to a single point charge that is not located at the origin.
You should then find the electrostatic potential everywhere in space for the following two cases:
Simplify your expressions, assuming that you are evaluating the potential along the $z$-axis. Then do the same, this time assuming you are on the $x$-axis.