95% of the XPS signal originates from the layer with the thickness 3x"lambda", where "lambda" is the electron mean free path (typically 10-20 Å depending on the material)
Adding to the above, the detection depth is also defined by the take-off angle of the electrons. Glancing angles (electrons leave nearly parallel to the surface) are more surface sensitive than perpendicular. The analysis depth is therefore approximately 3*lambda*sin(theta) with theta measured relative to the surface plane.
..and finally it also depends on the kinetic energy (KE) of the electron you are measuring, which since the binding energy for a particular element is fixed the KE can be varied if you use a tunable X-ray source, such as at a synchrotron. The minimum mean free path length is for electrons with a kinetic energy energy of 50 - 100 eV. You can download a useful database from NIST here https://www.nist.gov/srd/nist-standard-reference-database-71. It is free and allows you to calculate mean free path lengths and attenuation lengths for a range of materials based on density, theoretical elemental composition etc.
The detected depth of XPS is involved many factors including the energy of X-ray, the kinetic energy of core-level electrons, the secondary electron escape depth from materials, and so on. One more way, changer the incident angle of the x-ray also changes the detect depth, as shown in the attached picture. For more information, you can read this article:
[1] F.A. Stevie, C.L. Donley, Introduction to x-ray photoelectron spectroscopy, J Vac Sci Technol A, 38 (2020).