Inclusion Criteria:  PRE-REGISTRATION: Age >= 18 years PRE-REGISTRATION: Radiologically confirmed hepatocellular carcinoma (HCC) PRE-REGISTRATION: Eastern Cooperative Oncology Group (ECOG) performance status (PS) 0, 1 or 2 PRE-REGISTRATION: Able to swallow oral medication PRE-REGISTRATION: Willingness to provide mandatory tissue specimens for correlative research REGISTRATION: Tumor tissue must be FGF19 positive by messenger ribonucleic acid (mRNA) or immunohistochemistry (IHC)  REGISTRATION: Disease characteristics:  Radiologically confirmed hepatocellular carcinoma (HCC) that is not eligible for curative resection, transplantation, or ablative therapies Received at least one prior systemic treatment for HCC NOTE: Prior radiation, chemoembolization, radioembolization, or other local ablative therapies or hepatic resection are permitted  REGISTRATION: Measurable disease by any imaging modality as defined by Response Evaluation Criteria in Solid Tumors (RECIST) 1.1 criteria in at least one site not previously treated with radiation or liver directed therapy (including bland, chemo- or radio-embolization, or ablation  NOTE: Tumor lesions in a previously irradiated area are not considered measurable disease; disease that is measurable by physical examination only is not eligible REGISTRATION: ECOG performance status (PS) 0, 1 or 2 REGISTRATION: Absolute neutrophil count (ANC) >= 1500/mm^3 (=< 15 days prior to registration) REGISTRATION: Hemoglobin >= 9.0 g/dL (=< 15 days prior to registration) REGISTRATION: Platelet count >= 75,000/mm^3 (=< 15 days prior to registration) REGISTRATION: Albumin >= 2.5 g/dL (=< 15 days prior to registration) REGISTRATION: Alanine aminotransferase (ALT) and aspartate transaminase (AST) =< 2.5 x upper limit of normal (ULN) (or =< 5 x ULN for patients with liver metastasis) (=< 15 days prior to registration) REGISTRATION: Total bilirubin =< 1.5 x ULN (=< 15 days prior to registration) REGISTRATION: Phosphorus =< 1.5 x ULN (=< 15 days prior to registration) REGISTRATION: Calcium =< 1.5 x ULN (=< 15 days prior to registration) REGISTRATION: Prothrombin time/international normalized ratio/activated partial thromboplastin time (PT/INR/aPTT) =< 1.5 x ULN OR if patient is receiving anticoagulant therapy then INR or aPTT is within target range of therapy (=< 15 days prior to registration) REGISTRATION: Serum creatinine =< 1.5 x ULN (=< 15 days prior to registration) REGISTRATION: Calculated creatinine clearance >= 40 ml/min using the Cockcroft-Gault formula (=< 15 days prior to registration) REGISTRATION: Child-Pugh scores of =< 7 (Child-Pugh A or B7) REGISTRATION: Barcelona Clinic Liver Cancer Stage (BCLC) stage A, B, or C REGISTRATION: Negative pregnancy test done =< 7 days prior to registration, for persons of childbearing potential only  REGISTRATION: Willing to use an adequate method of contraception from registration through 120 days after the last dose of study medication  NOTE: Only for a) persons of childbearing potential or b) persons able to father a child with partners of childbearing potential REGISTRATION: Able to swallow oral medication REGISTRATION: Provide written informed consent REGISTRATION: Willingness to provide mandatory blood specimens for correlative research REGISTRATION: Willingness to provide mandatory tissue specimens for correlative research REGISTRATION: Willingness and the ability to comply with scheduled visits (including geographical proximity), treatment plans, laboratory tests, and other study procedures REGISTRATION: Ability to complete questionnaires by themselves or with assistance  Exclusion Criteria:  PRE-REGISTRATION: Prior organ transplantation PRE-REGISTRATION: History of untreated brain metastasis PRE-REGISTRATION: Co-morbid systemic illnesses or other severe concurrent disease which, in the judgment of the investigator, would make the patient inappropriate for entry into this study or interfere significantly with the proper assessment of safety and toxicity of the prescribed regimens  PRE-REGISTRATION: History or risk of autoimmune disease, including, but not limited to, systemic lupus erythematosus, rheumatoid arthritis, inflammatory bowel disease, vascular thrombosis associated with antiphospholipid syndrome, Wegener's granulomatosis, Sjogren's syndrome, Guillain-Barre syndrome, multiple sclerosis, autoimmune thyroid disease, vasculitis, or glomerulonephritis. Notes:  Patients with a history of autoimmune hypothyroidism on a stable dose of thyroid replacement hormone are eligible Patients with controlled Type 1 diabetes mellitus on a stable insulin regimen are eligible  Patients with eczema, psoriasis, lichen simplex chronicus of vitiligo with dermatologic manifestations only (e.g., patients with psoriatic arthritis would be excluded) are permitted provided that they meet the following conditions:  Rash must cover less than 10% of body surface area (BSA) Disease is well controlled at baseline and only requiring low potency topical steroids (e.g., hydrocortisone 2.5%, hydrocortisone butyrate 0.1%, flucinolone 0.01%, desonide 0.05%, aclometasone dipropionate 0.05%) No acute exacerbations of underlying condition within the last 6 months (not requiring psoralen plus ultraviolet A radiation [PUVA], methotrexate, retinoids, biologic agents, oral calcineurin inhibitors; high potency or oral steroids)  PRE-REGISTRATION: Other active malignancy < 6 months prior to registration  EXCEPTIONS: Non-melanotic skin cancer, papillary thyroid cancer, or carcinoma-in-situ of the cervix, or others curatively treated and now considered to be at less than 30% risk of relapse are eligible PRE-REGISTRATION: History of pneumonitis or interstitial lung disease within =< 3 years prior to pre-registration REGISTRATION: Known standard therapy for the patient's disease that is potentially curative or definitely capable of extending life expectancy  REGISTRATION: Any of the following because this study involves an investigational agent whose genotoxic, mutagenic and teratogenic effects on the developing fetus and newborn are unknown:  Pregnant persons Nursing persons Persons of childbearing potential who are unwilling to employ adequate contraception  REGISTRATION: Any of the following prior therapies:  Surgery =< 4 weeks prior to registration Radiotherapy for extended field =< 4 weeks prior to registration or limited field radiotherapy =< 2 weeks prior to registration  Systemic anticancer therapy =< 2 weeks prior to registration  NOTE: Prior immunotherapy is allowed unless patient discontinued due to grade 4 adverse event (AE) Live vaccine =< 30 days prior to registration Prior treatment with FGFR inhibitor Received strong inhibitors and inducers and sensitive substrates of CYP3A4 =< 2 weeks prior to registration  Received a drug that has not received regulatory approval for any indication as follows:  =< 2 weeks prior to registration for nonmyelosuppressive agents or =< 4 weeks prior to registration for myelosuppressive agents  REGISTRATION: History and/or current evidence of any of the following disorders:  Retinal or corneal disorder confirmed by retinal/corneal examination and considered clinically significant in the opinion of the Investigator  REGISTRATION: Active central nervous system (CNS) metastasis and/or carcinomatous meningitis  NOTE: Patients with previously treated brain metastases that are clinically and radiologically stable (for at least 4 weeks prior to enrollment) are eligible  REGISTRATION: History of hepatitis B (HBV) and viral load >= 100 IU/ml  NOTE: Patients who have received antiviral therapy and have viral load < 100 IU/ml are eligible  REGISTRATION: Corrected QT interval using Fridericia's formula (QTcF) > 480 msec  NOTE: Patients with an atrioventricular pacemaker or other condition (for example, right bundle branch block) that renders the QT measurement invalid are an exception and the criterion does not apply REGISTRATION: Co-morbid systemic illnesses or other severe concurrent disease which, in the judgment of the investigator, would make the patient inappropriate for entry into this study or interfere significantly with the proper assessment of safety and toxicity of the prescribed regimens REGISTRATION: Receiving any other investigational agent which would be considered as a treatment for the primary neoplasm  REGISTRATION: History or risk of autoimmune disease, including, but not limited to, systemic lupus erythematosus, rheumatoid arthritis, inflammatory bowel disease, vascular thrombosis associated with antiphospholipid syndrome, Wegener's granulomatosis, Sjogren's syndrome, Guillain-Barre syndrome, multiple sclerosis, autoimmune thyroid disease, vasculitis, or glomerulonephritis. Notes:  Patients with a history of autoimmune hypothyroidism on a stable dose of thyroid replacement hormone are eligible. Patients with controlled Type 1 diabetes mellitus on a stable insulin regimen are eligible.  Patients with eczema, psoriasis, lichen simplex chronicus of vitiligo with dermatologic manifestations only (e.g., patients with psoriatic arthritis would be excluded) are permitted provided that they meet the following conditions:  Must not have ocular manifestations Rash must cover less than 10% of body surface area (BSA) Disease is well controlled at baseline and only requiring low potency topical steroids (e.g., hydrocortisone 2.5%, hydrocortisone butyrate 0.1%, flucinolone 0.01%, desonide 0.05%, aclometasone dipropionate 0.05%) No acute exacerbations of underlying condition within the last 12 months (not requiring psoralen plus ultraviolet A radiation [PUVA], methotrexate, retinoids, biologic agents, oral calcineurin inhibitors; high potency or oral steroids)  REGISTRATION: Known active human immunodeficiency virus (HIV) infection (defined as patients who are not on anti-retroviral treatment and have detectable viral load and CD4+ < 500/ml)  NOTE: HIV-positive patients who are well controlled on anti-retroviral therapy are allowed to enroll REGISTRATION: Currently taking strong CYP3A inhibitors/inducers and unable to discontinue =< 7 days prior to registration  REGISTRATION: History and/or current evidence of any of the following disorders:  Non-tumor related alteration of the calcium-phosphorus homeostasis that is considered clinically significant in the opinion of the Investigator Ectopic mineralization/calcification, including but not limited to soft tissue, kidneys, intestine, or myocardia and lung, considered clinically significant in the opinion of the Investigator Retinal or corneal disorder confirmed by retinal/corneal examination and considered clinically significant in the opinion of the Investigator  REGISTRATION: Uncontrolled intercurrent illness including, but not limited to:  Ongoing or active severe infection  NOTE: Must be afebrile > 7 days to be eligible. Patient may be eligible if fever is present and infection has been ruled out or fever is related to tumor Psychiatric illness/social situations that would limit compliance with study requirements  REGISTRATION: Clinically significant or uncontrolled cardiac disease, including unstable angina, acute myocardial infarction within 6 months from day 1 of study treatment administration, New York Heart Association class III and IV congestive heart failure, and uncontrolled arrhythmia  NOTE: Participants with pacemaker or with atrial fibrillation and well controlled heart rate are allowed