Inclusion Criteria:  Age ≥ 18 years. Willing and able to give written informed consent. Have histologically or cytologically confirmed NSCLC, with presence of EGFR mutation(s) sensitive to EGFR inhibitors, or KRAS G12C mutation. Measurable disease per Response Evaluation Criteria in Solid Tumors (RECIST) v1.1. Adequate bone marrow and organ function. Have ECOG performance status of 0 or 1. Willing to comply with all protocol-required visits, assessments, and procedures. Able to swallow oral medication.  Exclusion Criteria:  Concurrent treatment with any systemic anticancer therapy for NSCLC, including any approved or investigational agent. For participants with EGFRm NSCLC: prior therapy with a RAS, RAF, MEK, or ERK inhibitor. For participants with KRAS G12Cm NSCLC: prior therapy with a SHP2, ERK, or KRAS G12C inhibitor (depending on which cohort is being considered for enrollment). Palliative radiotherapy within 7 days of enrollment. History of unacceptable toxicity to treatment with osimertinib or sotorasib. Major surgery within the 28 days of enrollment. Unresolved toxicities from prior systemic therapy greater than NCI CTCAE grade 1 at time of enrollment, except for toxicities not considered a safety risk (eg, alopecia, vitiligo, and grade 2 neuropathy due to prior chemotherapy). History of another malignancy ≤5 years prior to first dose, except for patients who are disease-free for >2 years after treatment with curative intent or who have carcinoma in situ. Symptomatic and unstable brain metastases, or spinal cord compression, except for patients who have completed definitive therapy (surgery or radiotherapy), are not on steroids, and have a stable neurologic status for a least 2 weeks after completion of the definitive therapy and steroids. History of or clinically active ILD, drug induced ILD, or radiation pneumonitis that required steroid treatment. Impaired cardiovascular function or clinically significant cardiovascular disease. History or current evidence of retinal pigment epithelial detachment (RPED), central serous retinopathy, retinal vein occlusion (RVO), or predisposing factors to RPED or RVO. Any evidence of severe or uncontrolled systemic disease or evidence of any other significant clinical disorder or laboratory finding that renders the patient inappropriate to participate in the study. Pregnant or breastfeeding women. Contraindication to osimertinib or sotorasib use as per local label.