The illustration below is in response to your comment on alephzero's answer.
I think you are confused with the stress on an inclined plane, after ddelection/rotation, that will have the force components $N $&$ S$ as shown. Assume a finite strip with unit width,
in direction of $"Z", A_X = 1 * \Delta L = \Delta L$,
$\sum \delta_Z = N cos\theta/\Delta L + S sin\theta/\Delta L = Pcos^2\theta/\Delta L + Psin^2\theta/\Delta L = P/\Delta L$;
in direction of $"X", A_Y = 1 * \Delta H = \Delta H$,
$\sum \delta_X = N sin\theta/\Delta H - S cos\theta/\Delta H = Pcos\theta\sin\theta/\Delta H - Psin\theta\cos\theta/\Delta H = 0$
So the conclusion is that the compressive stress under the vertical force $P$ is uniform over a finite length of $\Delta L$ in each direction, or the stress is uniformly throughout the contact area if P is uniformly applied pressure.
