For a hydrogen atom, according to Hertel and Schulz [1]:
$$\langle r\rangle_{n,\,l}=\frac{a_0 n^2 \left(\frac{1}{2} \left(1-\frac{l (l+1)}{n^2}\right)+1\right)}{Z}$$
and
$$\langle r^2\rangle_{n,\,l}=\frac{a_0^2 n^4 \left(\frac{3}{2} \left(1-\frac{l
(l+1)-\frac{1}{3}}{n^2}\right)+1\right)}{Z^2},$$
where $\langle r\rangle_{n,\,l}$ is the average distance of the electron from the nucleus as a function of n and l, and $\langle r^2\rangle_{n,\,l}$ is the average distance squared of the electron from the nucleus as a function of n and l, $a_0$ is the Bohr radius, and Z is the nuclear charge (Z = 1 for hydrogen). These are known as expectation values, because these are the expected values based on the probabilistic distribution of electron density.
Using these, we can compare $\langle r\rangle_{n,\,l}$ and $\langle r^2\rangle_{n,\,l}$ for the $3s \,(n = 3, l = 0), 3p \,(n = 3, l = 1) \text{ and } 3d\, (n = 3, l = 2)$ subshells:
$$\langle r\rangle_{3,\,0}= \frac{27 a_0}{2 Z}$$
$$\langle r\rangle_{3,\,1}= \frac{25 a_0}{2 Z}$$
$$\langle r\rangle_{3,\,2}= \frac{21 a_0}{2 Z}$$
$$\langle r^2\rangle_{3,\,0}= \frac{207 a_0^2}{Z^2}$$
$$\langle r^2\rangle_{3,\,1}= \frac{180 a_0^2}{Z^2}$$
$$\langle r^2\rangle_{3,\,2}= \frac{126 a_0^2}{Z^2}$$
You can see that, as the azimuthal quantum number (l) increases, the electron's average distance from the nucleus decreases. Note, however, that in hydrogen (or any single-electron atom, such as $\ce{He^+}$ or $\ce{Li^{2+}}$, etc.), all orbitals in the same shell have the same energy. Thus the energies of the 3s, 3p, and 3d orbitals are identical. As a consequence, a hydrogen electron excited to the third energy level is actually in a weighted linear combination of all of these orbitals, and its actual average distance would likewise be a weighted average of these.
But still, why does the average distance decrease with increasing azimuthal quantum number? Well, quantum is not my field, but I believe this is what's going on (perhaps a quantum expert can let us know if this is correct):
As I noted, in any single-electron atom, the 3s, 3p, and 3d orbitals have the same energy. The electron's energy is a combination of potential energy due to its distance from the nucleus, and the energy due to its angular momentum. As the azimuthal quantum number increases, the electron's angular momentum increases (it has no angular momentum in 3s, some in 3p, and more in 3d), and thus the energy associated with this angular momentum increases. But since the total energy is constant, as the energy due to angular momentum increases, the potential energy associated with distance from the nucleus must decrease, and hence the average distance from the nucleus gets lower.
Finally, you can see from the formula that $\langle r\rangle$ is much more sensitive to changes in n than l. For instance, if we compare the sizes of the s, p, and d subshells in the 3rd shell (n = 1, l = 0 to 2), $\langle r\rangle$ ranges from $\frac{27 a_0}{2 Z}$ to $\frac{25 a_0}{2 Z}$ to $\frac{21 a_0}{2 Z}$. By contrast, if we compare the sizes of the s-subshells in the first three shells (l = 0, n = 1 to 3), $\langle r\rangle$ ranges from $\frac{3 a_0}{2 Z}$ to $\frac{12 a_0}{2 Z}$ to $\frac{27 a_0}{2 Z}$.
- Hertel, Ingolf V., and Schulz, Claus-Peter. Atoms, molecules and optical physics. Berlin: Springer, 2015