Inclusion Criteria:  Aged ≥ 18 years old; With histologically or cytologically confirmed advanced metastatic gastric adenocarcinoma or adenocarcinoma of the gastroesophageal junction, or colorectal adenocarcinoma; Have at least one measurable lesion according to RECIST v1.1; With histologically confirmed FGFR1-3 alterations, including but not limited to amplification, mutation, fusion/rearrangement, etc.; With disease progression after a standard therapy (first-line therapy for gastric cancer; second-line therapy for colorectal cancer); No previous use of small molecule multi-target inhibitors targeting the FGFR pathway in the front-line therapy (including but not limited to anlotinib, lenvatinib, sorafenib, apatinib, etc.); ECOG physical performance status score of 0-1; Expected survival time > 3 months; For evidence of sufficient organ functions, the subjects shall meet the following laboratory parameters:  1) Absolute neutrophil count (ANC) ≥ 1.5 x 109/L without use of granulocyte colony stimulating factor in recent 14 days; 2) Platelet count ≥ 100 × 109/L without blood transfusion in recent 14 days; 3) Hemoglobin > 9 g/dL without blood transfusion or erythropoietin use in recent 14 days; 4) Total bilirubin ≤ 1.5 × upper limit of normal (ULN); or total bilirubin > ULN, direct bilirubin ≤ ULN; 5) Aspartate aminotransferase (AST) and alanine aminotransferase (ALT) ≤ 2.5 × ULN (ALT or AST ≤ 5 × ULN for patients with liver metastasis); 6) Blood creatinine ≤ 1.5 × ULN and creatinine clearance (calculated by Cockcroft-Gault formula) ≥ 50 mL/min; 7) Good coagulation function: international normalized ratio (INR) or prothrombin time (PT) ≤ 1.5 × ULN (For subjects receiving an anticoagulant therapy, PT within the range proposed for the anticoagulant drug is acceptable); 10. Women of childbearing potential shall obtain a negative result in the urine or serum pregnancy test performed within 3 days before the first dose of the investigational drug (cycle 1, day 1). If the urine pregnancy test result cannot be identified as negative, a blood pregnancy test is needed. Women of non-childbearing potential are defined as those who have not had menses for at least 1 year or who have undergone surgical sterilization or hysterectomy; 11. All subjects at risk of conception (including their partners) shall use contraceptives with an annual failure rate of less than 1% throughout the entire treatment period up to 120 days after the last dose of the investigational drug (or 180 days after the last dose of the chemotherapy drug).  Exclusion Criteria:  Diagnosed with malignant tumors other than gastric cancer and colorectal cancer within 5 years before the first dose, excluding radically cured cutaneous basal cell carcinoma, cutaneous squamous cell carcinoma, and/or radically resected carcinoma in situ; Previously treated with selective FGFR inhibitors; Have received any other investigational drug treatment or participated in another interventional clinical trial within 28 days before the first dose of the investigational drug, or have received anti-tumor drug treatment within 28 days before the first dose of the investigational drug (including Chinese herbal medicine with anti-tumor indications); Have not recovered (i.e., reaching ≤ grade 1 or the baseline status, excluding asthenia and alopecia) from toxicity and/or complications caused by any intervention before the start of treatment; With known symptomatic central nervous system metastasis and/or carcinomatous meningitis. Subjects with previously treated brain metastases are eligible if the disease is stable (no imaging evidence of progression in at least 4 weeks prior to the first dose of study treatment), there is no evidence of new or enlarging brain metastases on repeated imaging, and corticosteroids are not required in at least 14 days prior to the first dose of study treatment. Patients with carcinomatous meningitis should be excluded regardless of their clinically stability; Known history of allotransplantation or allogeneic hematopoietic stem cell transplantation;  Subjects with abnormal laboratory parameters listed below:  Serum phosphate > ULN; Serum calcium exceeds the normal range, or the calcium concentration corrected for serum albumin exceeds the normal range when serum albumin exceeds the normal range; Potassium level < lower limit of normal (LLN); potassium levels can be corrected by supplements at screening. With known history of human immunodeficiency virus (HIV) infection or confirmed with positive immune test results; Presence of severe infection in the active phase or with poor clinical control; Pleural effusion, ascites, or pericardial effusion with obvious clinical symptoms that require drainage; Acute or chronic active hepatitis B or C infection; hepatitis B virus (HBV) DNA > 2000 IU/mL or 104 copies/mL; hepatitis C virus (HCV) RNA > 103 copies/mL; hepatitis B surface antigen (HbsAg) and anti-HCV antibody positive concurrently. Those who with relevant parameters lower than the above criteria after nucleotide antiviral treatment can be enrolled; With clinically significant or uncontrolled heart diseases, including unstable angina, acute myocardial infarction within 6 months before the first dose, grade III/IV congestive heart failure (New York Heart Association), and uncontrolled arrhythmia (subjects with pacemakers or with atrial fibrillation but well controlled heart rate are allowed); With ECG changes or medical history considered clinically significant by the investigator; QTcF interval > 480 ms at screening; for subjects with intraventricular conduction block (QRS interval > 120 ms), JTc interval can be used instead of QTc interval (in such cases, JTc must be ≤ 340 ms); With uncontrolled hypertension (systolic pressure > 160 mmHg or diastolic pressure > 100 mmHg) after the optimal medical treatment, or a history of hypertensive crisis or hypertensive encephalopathy; With hepatic encephalopathy, hepatorenal syndrome, or liver cirrhosis with Child-Pugh grade B or C. Have received a major surgery (craniotomy, thoracotomy, or laparotomy) within 4 weeks prior to the first dose of study treatment, or will receive a major surgery during the study treatment period; Not fully recovered from toxicity and/or complications of a major surgery before the commencement of treatment; Pregnant or lactating women, or subjects expected to conceive or give birth during the study period from the screening visit to the completion of the safety follow-up visit (90 days after the last dose for male subjects); Have received radiotherapy within 4 weeks before the first dose of the investigational drug. The subjects must be completely recovered from radiotherapy-related toxicity, with no need for corticosteroid treatment, and radiation pneumonitis must be excluded. For palliative radiotherapy for non-CNS diseases, a 2-week washout period is allowed; Have a history of disorders of calcium and phosphorus metabolism or systemic electrolyte metabolism imbalance with ectopic calcification of soft tissues (excluding calcification of soft tissues such as skin, kidneys, tendon, or blood vessels without systemic electrolyte metabolism imbalance caused by injury, disease, and old age); Clinically significant corneal or retinal diseases confirmed by ophthalmological examination; Have used any potent CYP3A4 inhibitor (see Appendix A for details) or inducer within 14 days or 5 half lives (whichever is shorter) before the first dose of the investigational drug. Ketoconazole is allowed for external use; With known allergic reactions to pemigatinib or excipients of pemigatinib; Unable or unwilling to swallow pemigatinib or are suffering from significant digestive system diseases that may interfere with absorption, metabolism, or excretion; Subjects with a history of vitamin D deficiency who require supraphysiological dose of vitamin D (except dietary vitamin D supplements); Other acute or chronic diseases, psychiatric disorders, or laboratory abnormalities that may result in an increased risk associated with study participation or investigational drug administration or interfere with the interpretation of study results, and disqualify patients from the study in the investigator's judgment.