ImportanceChildren exposed to substance use during pregnancy have increased health needs but whether these are influenced by engagement in out-of-home care is uncertain.ObjectiveTo evaluate the association between substance use during pregnancy, out-of-home care and hospitalization utilization, and costs from birth up to age 20 years.Design, Setting, and ParticipantsThis was a retrospective cohort study using individual-linked population birth, hospital, and out-of-home care information of all liveborn infants from New South Wales, Australia, between 2001 and 2020 using longitudinal population-based linkage records from administrative databases. Substance use during pregnancy included newborns with neonatal abstinence syndrome (n = 5946) and intrauterine exposure to drugs of addiction (n = 1260) and other substances (eg, tobacco, alcohol, and illicit drugs or misused prescription drugs; n = 202 098). Children not exposed to substance use during pregnancy were those without known exposure to substance use during pregnancy (n = 1 611 351). Data were analyzed from July 2001 to December 2021.Main OutcomesMain outcomes were hospital readmission, length of stay, and cost burden associated with substance use during pregnancy from birth up to age 20 years. Outcomes were investigated using 2-part and Poisson regression models adjusted for sociodemographic characteristics. Mediation analysis was used to evaluate whether the association of substance use during pregnancy with risk of readmission was mediated through engagement with out-of-home care.ResultsOf the 1 820 655 live births, 935 807 (51.4%) were male. The mean (SD) age of mothers was 30.8 (5.5) years. Compared with children who were not exposed to substance use during pregnancy, those who were exposed incurred significantly higher birth hospital costs (adjusted mean difference, A$1585 per child [US$1 = A$1.51]; 95% CI, 1585-1586). If discharged alive, more children with exposure to substance use during pregnancy had at least 1 readmission (90 433/209 304 [43.4%] vs 616 425/1 611 351[38.3%]; adjusted relative risk [RR], 1.06; 95% CI, 1.06-1.07), most commonly for respiratory conditions (RR, 1.11; 95% CI, 1.09-1.12) and mental health/behavioral disorders (RR, 1.36; 95% CI, 1.33-1.41). Excess hospital costs associated with substance use during pregnancy were A$129.0 million in 2019 to 2020. Mediation analyses showed that any out-of-home care contact mediated the association between substance use during pregnancy and risk of inpatient readmission and lower health care cost (decreased by A$25.4 million). For children with neonatal abstinence syndrome, any out-of-home care contact mediated readmission risk by approximately 30%, from adjusted RR, 1.28; 95% CI, 1.19-1.35, to RR, 1.01; 95% CI, 0.98-1.02.Conclusion and RelevanceChildren who were exposed to substance use during pregnancy incurred more hospital costs than children who were not exposed up to 20 years of age, but this was reduced in association with any contact with out-of-home care. This provides insights into possible strategies for reducing health and financial burdens associated with exposure to substance use during pregnancy for children.