Testing the Combination of Two Anticancer Drugs M1774 (Tuvusertib) and Avelumab to Evaluate Their Safety and Effectiveness in Treating Merkel Cell Skin Cancer, MATRiX Trial

This phase II trial compares tuvusertib in combination with avelumab to tuvusertib alone to determine whether the combination therapy will lengthen the time before the cancer starts getting worse in patients with Merkel cell cancer that has not responded to previous treatment (refractory). Tuvusertib is a drug that inhibits an enzyme called ataxia telangiectasia and Rad3 related (ATR) kinase, which is an enzyme that plays a role in repair of damaged deoxyribonucleic acid (DNA) as well as tumor cell replication and survival. It may lead to tumor cell death by inhibiting ATR kinase activity. Immunotherapy with monoclonal antibodies, such as avelumab, may help the body's immune system attack the cancer, and may interfere with the ability of tumor cells to grow and spread. Giving tuvusertib in combination with avelumab may lengthen the time before Merkel cell cancer starts getting worse compared to giving avelumab alone.

PRIMARY OBJECTIVE:

I. To compare the potential efficacy, using progression free survival (PFS), of ATR inhibition alone to ATR inhibition plus anti-PD-(L)1 therapy through a randomized clinical trial for patients with advanced Merkel cell carcinoma (MCC) who have progressed on anti-PD(L)1 therapy.

SECONDARY OBJECTIVES:

I. To compare the clinical activity of ATR inhibition alone to that in combination with avelumab through a randomized clinical trial for patients with advanced MCC that has progressed after PD-1 pathway blockade.

II. To identify gene expression-based immunologic (replication stress / neuroendocrine \[NE\] differentiation) signatures predictive of response to ATR inhibition in advanced immunotherapy-refractory MCC tumors through ribonucleic acid sequencing (RNAseq).

EXPLORATORY OBJECTIVES:

I. To examine the association of various biomarkers with the clinical activity of ATR inhibition alone or in combination with PD-(L)1 pathway blockade.

II. To explore the safety and efficacy (PFS, overall response rate \[ORR\], and overall survival \[OS\]) of the addition of avelumab to M1774 (tuvusertib) after documented progressive disease of M1774 (tuvusertib) monotherapy.

OUTLINE: Patients are randomized to 1 of 2 arms.

ARM 1: Patients receive tuvusertib orally (PO) once daily (QD) on days 1-14 of each cycle. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Patients also undergo computed tomography (CT), positron emission tomography (PET)/CT, or magnetic resonance imaging (MRI), biopsy, and collection of blood and stool/rectal swabs at screening and on study. Patients with documented progression may cross over to Arm 2.

ARM 2: Patients receive tuvusertib PO QD on days 1-14 of each cycle and avelumab intravenously (IV) over 60 minutes on day 1 of each cycle. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Patients also undergo CT, PET/CT, or MRI, biopsy, and collection of blood and stool at screening and on study.

After completion of study treatment, patients are followed up at 30 days and then every 6 months for 2 years from the last dose of treatment.

Eligibility Criteria:
Inclusion Criteria:

* REGISTRATION ELIGIBILITY: Patients must have a history of pathologically confirmed locally advanced/unresectable Merkel cell carcinoma or metastatic Merkel cell carcinoma
* REGISTRATION ELIGIBILITY: Patients must have evaluable disease per Response Evaluation Criteria in Solid Tumors (RECIST) version (v)1.1
* REGISTRATION ELIGIBILITY: Patients must have had prior treatment with anti-PD-1 or anti-PD-L-1 antibody (e.g., pembrolizumab, avelumab, etc.) and have experienced progressive disease during treatment or within 120 days from the last dose of anti-PD-(L)1 therapy. Anti-PD-(L)1 therapy administered in combination with other agent(s) including ipilimumab is also allowed as prior therapy, if patients experienced progressive disease during treatment or within 120 days from the last dose of anti-PD-(L)1 therapy. If participants are receiving or received cytotoxic chemotherapy as most recent therapy prior to screening for this trial, there must be clinically and/or radiologically documented progressive disease on or after chemotherapy prior to being eligible for this study. If the patient is receiving bridging chemotherapy, the most recent administration must be ≥ 14 days prior to planned cycle 1 day 1 (C1D1) of the clinical trial to be eligible
* REGISTRATION ELIGIBILITY: Age \>= 18 years. Because no dosing or adverse event data are currently available on the use of M1774/tuvusertib in combination with avelumab in patients \< 18 years of age, children are excluded from this study
* REGISTRATION ELIGIBILITY: Eastern Cooperative Oncology Group (ECOG) performance status =\< 2 (Karnofsky \>= 60%)
* REGISTRATION ELIGIBILITY: Absolute neutrophil count \>= 1,000/mcL
* REGISTRATION ELIGIBILITY: Platelets \>= 100,000/mcL
* REGISTRATION ELIGIBILITY: Total bilirubin =\< institutional upper limit of normal (ULN) or ≤ 1.5 x ULN for subjects with Gilbert's disease
* REGISTRATION ELIGIBILITY: Aspartate aminotransferase (AST)(serum glutamic-oxaloacetic transaminase \[SGOT\])/alanine aminotransferase (ALT) (serum glutamate pyruvate transaminase \[SGPT\]) =\< 3 x institutional ULN
* REGISTRATION ELIGIBILITY: Creatinine =\< institutional ULN
* REGISTRATION ELIGIBILITY: Estimated glomerular filtration rate (eGFR) \>= 60 mL/min/1.73 m\^2
* REGISTRATION ELIGIBILITY: Hemoglobin \>= 9.0 g/dL
* REGISTRATION ELIGIBILITY: Human immunodeficiency virus (HIV)-infected patients on effective anti-retroviral therapy with undetectable viral load within 6 months are eligible for this trial
* REGISTRATION ELIGIBILITY: For patients with evidence of chronic hepatitis B virus (HBV) infection, the HBV viral load must be undetectable on suppressive therapy, if indicated
* REGISTRATION ELIGIBILITY: Patients with a history of hepatitis C virus (HCV) infection must have been treated and cured. For patients with HCV infection who are currently on treatment, they are eligible if they have an undetectable HCV viral load
* REGISTRATION ELIGIBILITY: Patients with treated brain metastases are eligible if follow-up brain imaging during screening shows no evidence of progressive brain metastases and it has been at least 4 weeks since central nervous system (CNS) directed therapy
* REGISTRATION ELIGIBILITY: Patients with a prior or concurrent malignancy whose natural history or treatment does not have the potential to interfere with the safety or efficacy assessment of the investigational regimen are eligible for this trial
* REGISTRATION ELIGIBILITY: Patients with known history or current symptoms of cardiac disease, or history of treatment with cardiotoxic agents, should have a clinical risk assessment of cardiac function using the New York Heart Association Functional Classification. To be eligible for this trial, patients should be class 2B or better
* REGISTRATION ELIGIBILITY: The effects of M1774(tuvusertib) on the developing human fetus are unknown. For this reason and because ATR inhibitor agents as well as other therapeutic agents used in this trial are known to be teratogenic, women of child-bearing potential must agree to use adequate contraception (hormonal or barrier method of birth control; abstinence) prior to study entry and, for the duration of study participation, and 6 months after completion of M1774 (tuvusertib) and avelumab administration. Should a woman become pregnant or suspect she is pregnant while she or her partner is participating in this study, she should inform her treating physician immediately. Men treated or enrolled on this protocol must also agree to use adequate contraception prior to the study, for the duration of study participation, and 3 months after completion of M1774 (tuvusertib) and avelumab administration
* REGISTRATION ELIGIBILITY: Ability to understand and the willingness to sign a written informed consent document. Legally authorized representatives may sign and give informed consent on behalf of study participants
* CROSSOVER ELIGIBILITY: Patient was initially assigned to arm 1 (M1774/tuvusertib monotherapy) and completed at least 21 of 28 possible doses of M1774/ tuvusertib
* CROSSOVER ELIGIBILITY: Patients must have documented progressive disease per RECIST v 1.1
* CROSSOVER ELIGIBILITY: ECOG performance status ≤ 2 (Karnofsky ≥ 60%)
* CROSSOVER ELIGIBILITY: Absolute neutrophil count ≥ 1,000/mcL (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Platelets ≥ 100,000/mcL (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Total bilirubin ≤ institutional upper limit of normal (ULN) or ≤ 1.5 x ULN for subjects with Gilbert's disease (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: AST(SGOT)/ALT(SGPT) ≤ 3 × institutional ULN (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Creatinine ≤ institutional ULN (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Estimated glomerular filtration rate (eGFR) ≥ 60 mL/min/1.73 m\^2 (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Hemoglobin ≥ 9.0 g/dL (within 14 days of crossover registration)
* CROSSOVER ELIGIBILITY: Human immunodeficiency virus (HIV)-infected patients on effective anti-retroviral therapy with undetectable viral load within 6 months are eligible for this trial
* CROSSOVER ELIGIBILITY: For patients with evidence of chronic hepatitis B virus (HBV) infection, the HBV viral load must be undetectable on suppressive therapy, if indicated
* CROSSOVER ELIGIBILITY: Patients with a history of hepatitis C virus (HCV) infection must have been treated and cured. For patients with HCV infection who are currently on treatment, they are eligible if they have an undetectable HCV viral load
* CROSSOVER ELIGIBILITY: Patients with treated brain metastases are eligible if follow-up brain imaging during screening shows no evidence of progressive brain metastases and it has been at least 4 weeks since central nervous system (CNS) directed therapy
* CROSSOVER ELIGIBILITY: Patients with a prior or concurrent malignancy whose natural history or treatment does not have the potential to interfere with the safety or efficacy assessment of the investigational regimen are eligible for this trial
* CROSSOVER ELIGIBILITY: Patients with known history or current symptoms of cardiac disease, or history of treatment with cardiotoxic agents, should have a clinical risk assessment of cardiac function using the New York Heart Association Functional Classification. To be eligible for this trial, patients should be class 2B or better
* CROSSOVER ELIGIBILITY: The effects of M1774 (tuvusertib) on the developing human fetus are unknown. For this reason and because ATR inhibitor agents as well as other therapeutic agents used in this trial are known to be teratogenic, women of child-bearing potential must agree to use adequate contraception (hormonal or barrier method of birth control; abstinence) prior to study entry and, for the duration of study participation, and 6 months after completion of M1774 (tuvusertib) and avelumab administration. Should a woman become pregnant or suspect she is pregnant while she or her partner is participating in this study, she should inform her treating physician immediately. Men treated or enrolled on this protocol must also agree to use adequate contraception prior to the study, for the duration of study participation, and 3 months after completion of M1774 (tuvusertib) and avelumab administration

Exclusion Criteria:

* REGISTRATION EXCLUSION: Patients with life-threatening immune-related adverse events (IRAEs) related to prior anti-PD-(L)1 antibody. Patients with a history of IRAE of grade 4 (G4) severity (excluding thyroid or endocrine disorders now controlled) or IRAE of any severity that required permanent treatment discontinuation with prior immune checkpoint inhibitor (ICI) therapy due to toxicity
* REGISTRATION EXCLUSION: Patients with a prior history of ataxia telangiectasia
* REGISTRATION EXCLUSION: Patients who are receiving any other investigational agents
* REGISTRATION EXCLUSION: History of allergic reactions attributed to compounds of similar chemical or biologic composition to M1774/tuvusertib or avelumab
* REGISTRATION EXCLUSION: Patients with uncontrolled intercurrent illness or any other significant condition(s) that would make participation in this protocol unreasonably hazardous
* REGISTRATION EXCLUSION: Pregnant women are excluded from this study because M1774 (tuvusertib) and avelumab have the potential for teratogenic or abortifacient effects. Because there is an unknown but potential risk for adverse events in nursing infants secondary to treatment of the mother with M1774 (tuvusertib) and avelumab breastfeeding should be discontinued if the mother is treated with M1774 (tuvusertib) or avelumab and for at least 1 month after the last dose of study medications. These potential risks may also apply to other agents used in this study
* REGISTRATION EXCLUSION: Patients who are not able to swallow orally administered medication or have gastrointestinal disorders likely to interfere with absorption of the study medication
* REGISTRATION EXCLUSION: Patients who cannot discontinue proton-pump inhibitors (PPIs)
* REGISTRATION EXCLUSION: Patients who have not recovered from adverse events due to prior anti-cancer therapy (i.e., have residual toxicities \> grade 1) with the exception of alopecia and neuropathy, which may be =\< grade 2. Patients with endocrinopathies requiring hormone replacement (such as hypothyroidism, autoimmune diabetes mellitus, adrenal insufficiency) will be allowed
* REGISTRATION EXCLUSION: M1774/ tuvusertib is primarily metabolized by aldehyde oxidase and to a lesser extent CYP3A4 and CYP1A2; therefore, concomitant administration with strong inhibitors of CYP3A4 (e.g., ketoconazole, itraconazole, clarithromycin, ritonavir, indinavir, nelfinavir and saquinavir) and CYP1A2 or inducers of CYP3A4 (e.g. rifampin, phenytoin, carbamazepine, phenobarbital, St. John's Wort) and CYP1A2 are prohibited. M1774/ tuvusertib is an inhibitor of MATE1 and MATE2K and substrates of these transporters are also prohibited. These include metformin, acyclovir, estrone sulfate, ciprofloxacin and cephalexin. Patients who are taking such medications who cannot discontinue or switch them to an acceptable alternative are not eligible

  * Because the lists of these agents are constantly changing, it is important to regularly consult a frequently-updated medical reference for a list of drugs to avoid or minimize use of. One example of such a reference is here (https://go.drugbank.com/categories/DBCAT003956)
  * As part of the enrollment/informed consent procedures, the patient will be counseled on the risk of interactions with other agents, and what to do if new medications need to be prescribed or if the patient is considering a new over-the-counter medicine or herbal product
* REGISTRATION EXCLUSION: Patients who are on chronic corticosteroid treatment exceeding 10 mg prednisone daily (or equivalent) are excluded. Chronic corticosteroid use lower than this range is permitted
* REGISTRATION EXCLUSION: Patients with a QTcF (using the Fridericia correction calculation) of \> 470 msec
* CROSSOVER EXCLUSION: Patients with life-threatening immune-related adverse events (IRAEs) related to prior anti-PD-(L)1 antibody. Patients with a history of IRAE of G4 severity (excluding thyroid or endocrine disorders now controlled) or IRAE of any severity that required permanent treatment discontinuation with prior ICI therapy due to toxicity
* CROSSOVER EXCLUSION: Patients with a prior history of ataxia telangiectasia.
* CROSSOVER EXCLUSION: Patients who are receiving any other investigational agents
* CROSSOVER EXCLUSION: History of allergic reactions attributed to compounds of similar chemical or biologic composition to M1774/tuvusertib or avelumab
* CROSSOVER EXCLUSION: Patients with uncontrolled intercurrent illness or any other significant condition(s) that would make participation in this protocol unreasonably hazardous
* CROSSOVER EXCLUSION: Pregnant women are excluded from this study because M1774 (tuvusertib) and avelumab have the potential for teratogenic or abortifacient effects. Because there is an unknown but potential risk for adverse events in nursing infants secondary to treatment of the mother with M1774 (tuvusertib) and avelumab breastfeeding should be discontinued if the mother is treated with M1774 (tuvusertib) or avelumab and for at least 1 month after the last dose of study medications. These potential risks may also apply to other agents used in this study
* CROSSOVER EXCLUSION: Patients who are not able to swallow orally administered medication or have gastrointestinal disorders likely to interfere with absorption of the study medication
* CROSSOVER EXCLUSION: Patients who cannot discontinue proton-pump inhibitors (PPIs)
* CROSSOVER EXCLUSION: Patients who have not recovered from adverse events due to prior anti-cancer therapy (i.e., have residual toxicities \> grade 1) with the exception of alopecia and neuropathy which may be ≤ grade 2. Additionally, anemia felt related to M1774/tuvusertib may be grade 2 as long as it exceeds requirement of hemoglobin \> 9 g/dL. Patients with endocrinopathies requiring hormone replacement (such as hypothyroidism, autoimmune diabetes mellitus, adrenal insufficiency) will be allowed
* CROSSOVER EXCLUSION: M1774/ tuvusertib is primarily metabolized by aldehyde oxidase and to a lesser extent CYP3A4 and CYP1A2; therefore, concomitant administration with strong inhibitors of CYP3A4 (e.g., ketoconazole, itraconazole, clarithromycin, ritonavir, indinavir, nelfinavir and saquinavir) and CYP1A2 or inducers of CYP3A4 (e.g. rifampin, phenytoin, carbamazepine, phenobarbital, St. John's Wort) and CYP1A2 are prohibited. M1774/ tuvusertib is an inhibitor of MATE1 and MATE2K and substrates of these transporters are also prohibited. These include metformin, acyclovir, estrone sulfate, ciprofloxacin and cephalexin. Patients who are taking such medications who cannot discontinue or switch them to an acceptable alternative are not eligible. Because the lists of these agents are constantly changing, it is important to regularly consult a frequently-updated medical reference for a list of drugs to avoid or minimize use of. One example of such a reference is here (https://go.drugbank.com/categories/DBCAT003956). Patient Drug Information Handout and Wallet Card) should be provided to patients. As part of the enrollment/informed consent procedures, the patient will be counseled on the risk of interactions with other agents, and what to do if new medications need to be prescribed or if the patient is considering a new over-the-counter medicine or herbal product
* CROSSOVER EXCLUSION: Patients who are on chronic corticosteroid treatment exceeding 10 mg prednisone daily (or equivalent) are excluded. Chronic corticosteroid use lower than this range is permitted
* CROSSOVER EXCLUSION: Patients with a QTcF (using the Fridericia correction calculation) of \> 470 msec