PRIMARY OBJECTIVES:
I. To assess whether ALK kinase domain mutations (G1202/C1156Y/I1171/L1196/ V1180/ F1174/compound mutation) associated with drug resistance are prognostic for objective response to subsequent ALK inhibitor therapy.
II. To assess whether subsequent pemetrexed based chemotherapy improves objective response comparing to ALK inhibitor therapy for no ALK mutation patients.
III. To evaluate objective responses of patients with specific genetic alterations (ALKL1198F/MET double mutation or high-level MET gene amplification) treated with crizotinib.
SECONDARY OBJECTIVES:
I. Progression-free survival (PFS). II. Duration of response (DOR). III. Overall survival (OS). IV. Intracranial objective response rate (ORR). V. Safety and tolerability.
CORRELATIVE SCIENCE OBJECTIVE:
I. Establish concordance between tumor and liquid biopsies.
OUTLINE:
Patients with a G1202R or G1202del mutation receive either lorlatinib orally (PO) once daily (QD) or brigatinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a C1156Y mutation receive either lorlatinib PO QD, brigatinib PO QD, or alectinib PO twice daily (BID). Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a I1171 mutation receive either lorlatinib PO QD, ceritinib PO QD, or brigatinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a L1196 mutation receive either lorlatinib PO QD, brigatinib PO QD, ensartinib PO QD, alectinib PO BID, or ceritinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a V1180 mutation receive either lorlatinib PO QD, brigatinib PO QD, or ceritinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a F1174 mutation receive either alectinib PO BID, lorlatinib PO QD, or brigatinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with a compound mutation receive lorlatinib PO QD. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with an ALK L1198F mutation alone or with another mutation, and patients with high level MET amplification receive crizotinib PO BID. Cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity.
Patients with no ALK-resistant mutations receive either lorlatinib PO QD, ceritinib PO QD, alectinib PO BID, brigatinib PO QD, or ensartinib PO QD, or pemetrexed intravenously (IV) over 10 minutes on day 1 and either cisplatin IV or carboplatin IV on day 1. ALK inhibitor cycles repeat every 21 days in the absence of disease progression or unacceptable toxicity. Pemetrexed-based treatment repeats every 21 days for up to 6 cycles in the absence of disease progression or unacceptable toxicity. Maintenance treatment of pemetrexed may continue until disease progression or unacceptable toxicity.
After completion of study treatment, patients are followed up for 30 days, every 3 months for 2 years, every 6 months for 3 years, and annually thereafter.
Inclusion Criteria:
* PRIOR TO STEP 1 REGISTRATION
* Patients must have histologically or cytologically confirmed stage IV ALK-positive non-squamous non-small cell lung carcinoma (NSCLC) (includes M1a, M1b, M1c stage disease, American Joint Committee on Cancer \[AJCC\] 8th edition). ALK rearrangement must have been demonstrated by a Food and Drug Administration (FDA) approved assay (Vysis fluorescence in situ hybridization \[FISH\] or Ventana immunohistochemistry \[IHC\]) or by next generation sequencing (NGS)
* Patient must be willing and able to undergo a fresh biopsy or if patient has a biopsy after progression on current tyrosine-kinase inhibitor (TKI) within 3 months of study enrollment (and has continued TKI for clinical benefit per treating physician) this tissue may be used. Must have sufficient tissue
* Patient must have progressive disease as defined by Response Evaluation Criteria in Solid Tumors (RECIST) 1.1 after one second generation ALK inhibitor, including LDK378 (ceritinib), alectinib, ensartinib, and brigatinib (may not have received more than one second-generation ALK inhibitor). Patient may have received prior crizotinib; however, the second generation ALK inhibitor received must be the last treatment given prior to study enrollment
* Prior lorlatinib (third-generation ALK inhibitor) is not allowed
* Prior chemotherapy is not allowed except for one prior cycle received at the time of original diagnosis of metastatic NSCLC with no evidence of disease progression following the cycle. NOTE: prior adjuvant or neoadjuvant chemotherapy is allowed if last dose was received more than 12 months prior to enrollment
* The patient or a legally authorized representative must provide study-specific informed consent prior to Step 1 Registration
* PRIOR TO STEP 2 REGISTRATION
* Absolute neutrophil count (ANC) \>= 1500 cells/mm\^3 (within 28 days prior to step 2 registration)
* Platelets \>= 100,000 cells/mm\^3 (within 28 days prior to step 2 registration)
* Estimated creatinine clearance \>= 60 mL/min by the Cockcroft Gault formula (within 28 days prior to step 2 registration)
* Total bilirubin =\< 1.5 x upper limit of normal (ULN) (except for patients with documented Gilbert's syndrome) (within 28 days prior to step 2 registration)
* Aspartate aminotransferase (AST) =\< 2.5 x ULN; =\< 5 x ULN if liver metastases are present (within 28 days prior to step 2 registration)
* Alanine aminotransferase (ALT) =\< 2.5 x ULN; =\< 5 x ULN if liver metastases are present (within 28 days prior to step 2 registration)
* Patients with asymptomatic treated or untreated brain metastases are eligible. Treated brain metastases are eligible as long as patients have measurable disease outside the brain according to RECIST 1.1. Patients must be on a stable or decreasing dose of steroids for at least 7 days prior to step 2 registration. Anticonvulsants are allowed as long as the patient is neurologically stable and not deteriorating
* Patients enrolled with asymptomatic brain metastases (mets) must have at least one measurable target extracranial lesion according to RECIST 1.1
* Eastern Cooperative Oncology Group (ECOG) performance status 0-2
* Acute effects of any prior therapy resolved to baseline severity or to Common Terminology Criteria for Adverse Events (CTCAE) grade =\< 1 (except for alopecia, hearing loss)
* Not taking any medications that may interact with selected study medication based on stratification
* Patients must be able to take oral medications (i.e. swallow whole tablets/capsules)
* All females of childbearing potential must have a blood test or urine study within 14 days prior to Step 2 Registration to rule out pregnancy. A female of childbearing potential is any woman, regardless of sexual orientation or whether they have undergone tubal ligation, who meets the following criteria:
* Has not undergone a hysterectomy or bilateral oophorectomy; or
* Has not been naturally postmenopausal for at least 24 consecutive months (i.e., has had menses at any time in the preceding 24 consecutive months)
* Women must not be pregnant or breast-feeding due to potential harm to the fetus or infant from ALK inhibitors and the unknown risk. Women of childbearing potential and sexually active males must agree to use an accepted and effective method of contraception or to abstain from sexual intercourse for the duration of their participation in the study
Exclusion Criteria:
* Major surgery within 2 weeks of study entry. Minor surgical procedures (e.g., port insertion, pleurex catheter placement) are allowed and all wounds must not show signs of infection or draining
* Palliative RT (\< 10 fractions) must have been completed at least 48 hours prior to study entry. Stereotactic or small field brain irradiation must have completed at least 1 week prior to study entry. Whole brain RT or other palliative RT must have been completed at least 2 weeks prior to study entry
* Prior dose of next generation ALK inhibitor (LDK378 \[ceritinib\], alectinib, ensartinib, lorlatinib) within 5 days prior to step 2 registration. Prior dose of brigatinib within 7 days prior to step 2 registration
* History of interstitial lung disease or interstitial fibrosis, including a history of pneumonitis, obliterative bronchiolitis, pulmonary fibrosis. Patients with a history of prior radiation pneumonitis are not excluded
* Active inflammatory gastrointestinal disease (such as Crohns, ulcerative colitis), chronic diarrhea, symptomatic diverticular disease, or any gastrointestinal disease that would affect the absorption of oral medications or increase the risk of toxicity
* Clinically significant cardiovascular abnormalities, as determined by the treating/registering physician, such as uncontrolled hypertension, congestive heart failure New York Heart Association (NYHA) classification of 3, unstable angina or poorly controlled arrhythmia, or myocardial infarction within 6 months
* Active and clinically significant bacterial, fungal, or viral infection
* Patients with active or chronic pancreatitis based on lipase elevation, symptoms, and radiographic findings
* Other concomitant serious illness or organ system dysfunction that in the opinion of the investigator would either compromise patient safety or interfere with the evaluation of the safety of the study drug
* Patients must not plan to receive any other investigational agents during the course of therapy
* Patients with active malignancy other than ALK-positive non-squamous NSCLC within the last 2 years are excluded (note: adequately treated basal cell or squamous cell skin cancer, in situ cervical cancer, papillary thyroid cancer treated with curative intent, adequately treated stage I or II cancer from which the patient is currently in complete remission, or any other cancer from which the patient has been disease free for 2 years are eligible)
* No chemotherapy and/or immunotherapy allowed after step 1 registration