Corticosteroids decrease the duration of organ dysfunction in a range of infectious critical illnesses, but their risk and benefit are not fully defined using this construct. This retrospective multicenter study aimed to evaluate the association between usage of corticosteroids and mortality of patients with infectious critical illness by emulating a target trial framework. The study employed a novel stratification method with predictive machine learning (ML) subphenotyping based on organ dysfunction trajectory. Our analysis revealed that corticosteroids' effectiveness varied depending on the stratification method. The ML-based approach identified four distinct subphenotypes, two of which had a large enough sample size in our patient cohorts for further evaluation: "Rapidly Improving" (RI) and "Rapidly Worsening," (RW) which showed divergent responses to corticosteroid treatment. Specifically, the RW group either benefited or were not harmed from corticosteroids, whereas the RI group appeared to derive harm. In the development cohort, which comprised of a combination of patients from the eICU and MIMIC-IV datasets, hazard ratio estimates for the primary outcome, 28-day mortality, in the RW group was 1.05 (95% CI: 0.96 - 1.04) whereas for the RW group, it was 1.40 (95% CI: 1.28 - 1.54). For the validation cohort, which comprised of patients from the Critical carE Database for Advanced Research, estimates for 28-day mortality for the RW and RI groups were 1.24 (95% CI: 1.05 - 1.46) and 1.34 (95% CI: 1.14 - 1.59), respectively. For secondary outcomes, the RW group had a shorter time to ICU discharge and time to cessation of mechanical ventilation with corticosteroid treatment, where the RI group again demonstrated harm. The findings support matching treatment strategies to empirically observed pathobiology and offer a more nuanced understanding of corticosteroid utility. Our results have implications for the design and interpretation of both observational studies and randomized controlled trials (RCTs), suggesting the need for stratification methods that account for the differential response to standard of care.