Stratified analysis should be used when there is a possibility of confounding or effect modification. Confounding occurs when an extraneous variable is associated with both the exposure and the outcome, potentially distorting the observed relationship. Effect modification, on the other hand, occurs when the effect of the primary exposure on the outcome differs depending on the level of another variable.