PRIMARY OBJECTIVE:
I. To evaluate the efficacy of letermovir prophylaxis in the prevention of clinically significant CMV infection through Week 14 (\~100 days) post-transplant in children and adolescents receiving allogeneic hematopoietic cell transplant (allo-HCT).
SECONDARY OBJECTIVE:
I. To evaluate the efficacy of letermovir prophylaxis as assessed by CMV-free survival through 24 weeks (\~6 months) post-transplant in pediatric patients.
EXPLORATORY OBJECTIVES:
I. To evaluate the incidence of clinically significant CMV infection through 24 and 52 weeks post-transplant in patients who receive letermovir prophylaxis.
II. To evaluate overall survival post-transplant in patients who receive letermovir prophylaxis.
III. To evaluate time to engraftment and describe the cumulative incidence of non-engraftment among patients who receive letermovir.
IV. To examine the following clinically significant adverse events among patients exposed to letermovir: the total duration of neutropenia through week 14 (\~100 days) post-transplant, the cumulative incidence of acute kidney injury and chronic kidney disease by 52 weeks post-transplant, and total inpatient hospital days by 14 weeks (\~100 days) and 52 weeks post-transplant.
V. Describe patterns of anti-viral resistance at the onset of CMV DNAemia after allo-HCT among patients who receive letermovir prophylaxis.
VI. To describe immune reconstitution and CMV-specific immunity among patients who receive letermovir prophylaxis.
OUTLINE: Patients are randomized to 1 of 2 arms.
ARM A: Patients receive letermovir orally (PO) or intravenously (IV) over 60 minutes once daily (QD) starting on day +1 post-transplant for 14 weeks. Patients undergo collection of blood samples for CMV polymerase chain reaction (PCR) analysis weekly for 14 weeks, every 2 weeks until week 24, week 32, week 40 and week 52.
ARM B: Patients undergo collection of blood samples for CMV PCR analysis weekly for 14 weeks, every 2 weeks until week 24, week 32, week 40 and week 52.
Inclusion Criteria:
* \>= 2 years and \< 18 years at the time of enrollment
* Weight must be \>= 18 kg. For patients \< 12 years of age and expected to receive cyclosporine, weight must be \>= 30kg
* Planned allogeneic HCT (bone marrow, peripheral blood stem cell, or cord blood transplant)
* Patient must be CMV sero-positive (i.e., recipient CMV immunoglobulin G positive)
* Patient is eligible for entry only if it is feasible for plasma CMV PCR testing to be sent and resulted within the protocol mandated time period
* Reminder: To limit the likelihood of positive plasma CMV PCR post-enrollment and prior to start of study treatment period, it is recommended that patient enrollment proceed after patients start their transplant preparative regimen
* Patient must have a performance status corresponding to Lansky/Karnofsky scores \> 50
* Note: Use Lansky for patients =\< 16 years of age and Karnofsky for patients \> 16 years of age. For further reference, see performance status scales scoring under the standard sections for protocols among protocol reference materials provided on the Children's Oncology Group (COG) member website: https://members.childrensoncologygroup.org/prot/reference\_materials.asp
* Estimated glomerular filtration rate \> 15 mL/min/1.73 m\^2 and not receiving dialysis
* Total bilirubin =\< 2.5 mg/dL and serum glutamate-pyruvate transaminase (SPGT) (alanine transaminase \[ALT\]) =\<10 x upper limit of normal (ULN) for age
* Note: For the purpose of this study, the ULN for SGPT (ALT) has been set to the value of 45 U/L
Exclusion Criteria:
* Expected inability to tolerate oral formulation (e.g., unable swallow whole tablets) of letermovir
* Note: Determination of ability to tolerate the oral formulation will be based on a self-assessment or caregiver assessment; eligible subjects and their caregiver will be shown a life size picture of a tablet (or actual tablet) and confirm ability to swallow whole tablet in order to meet study eligibility
* Hypersensitivity to letermovir or any component of the formulation
* History of CMV end organ disease within 6 months (180 days) prior to enrollment
* Note: CMV end organ disease based on proposed definitions by Ljungman et al. and inclusive of proven, probable or possible disease
* Receipt of prior allogeneic HCT within one year of study enrollment
* Planned prophylactic administration of other anti-CMV medications or cellular products during the study, including:
* High dose acyclovir (defined as doses \>= 1500 mg/m\^2 IV or \>= 3200 mg oral (patients \>= 40 kg) or \>= 2400 mg/m\^2 (patients \< 40 kg) per day)
* High dose valacyclovir (defined as doses \>= 3000 mg/day in patients \> 20 kg)
* Foscarnet
* Ganciclovir
* Valganciclovir
* CMV-directed cytotoxic T lymphocytes
* Planned receipt of the following contraindicated medications during the study treatment period; contraindicated medications must be discontinued at least 14 days prior to Day +1
* Contraindicated medications for all patients:
* Pimozide
* Ergot alkaloids
* Contraindicated medications for patients planned to receive cyclosporine:
* Bosentan
* Lovastatin
* Pitavastatin
* Rosuvastatin
* Simvastatin
* Female patients who are pregnant since fetal toxicities and teratogenic effects have been noted in certain animal reproduction studies with letermovir. A pregnancy test is required for female patients of childbearing potential
* Lactating females who plan to breastfeed their infants
* Sexually active female patients of reproductive potential who have not agreed to use an effective contraceptive method for the duration of their letermovir treatment and through at least 4 weeks after the last dose of letermovir.
* Note: No contraception measures are needed specifically during letermovir treatment for male trial participants who have pregnant or non-pregnant female partner(s) of reproductive potential. Contraception measures may be required for other aspects of the HCT procedure.
* All patients and/or their parents or legal guardians must sign a written informed consent
* All institutional, Food and Drug Administration (FDA), and National Cancer Institute (NCI) requirements for human studies must be met