Every machined dimension comes with a tolerance. When several parts sit in a row, their tolerances add up, and the gap you designed can close to nothing. A stack-up tells you the smallest and largest gap before anything is cut.
The worst-case method
List every dimension in the chain from one side of the gap to the other. Add those that open the gap and subtract those that close it, using the extreme limits each time.
Housing bore depth 40.00 +0.10 / -0.00
Bearing width 12.00 +0.00 / -0.12
Spacer 27.80 ±0.05
Min gap = 40.00 - 12.00 - 27.85 = 0.15 mm
Max gap = 40.10 - 11.88 - 27.75 = 0.47 mm
When worst case is too strict
With many parts, worst case asks for tolerances that are expensive to hold. The statistical (RSS) method assumes errors rarely all hit their limits at once and gives a tighter, realistic range. Use it only when the parts come from a stable process.
