Inclusion Criteria:  HIGH-RISK STRATUM: Participant is able to understand and willing to sign a written informed consent document HIGH-RISK STRATUM: Participant must have histologically proven stage (T3-T4N0M0 OR T2-4N1M0) invasive squamous cell carcinoma (SCC) of the anus or anorectum as documented before CRT initiation, according to the American Joint Committee on Cancer (AJCC) 8th edition. Participants with squamous cell carcinoma of the anal margin are eligible if there is evidence of extension of the primary tumor into the anal canal. Participants with tumors of non-keratinizing histology such as basaloid, transitional cell or cloacogenic histology are permitted  HIGH-RISK STRATUM: HIV-positive. Documentation of HIV-1 infection by means of any one of the following:  Documentation of HIV diagnosis in the medical record by a licensed health care provider. If the record contains information that the patient is taking Food and Drug Administration (FDA)-approved combination therapy for HIV infection, then this can be part of the record substantiating the HIV positive diagnosis HIV-1 ribonucleic acid (RNA) detection by a licensed HIV-1 RNA assay demonstrating > 1000 RNA copies/mL  Any licensed HIV screening antibody and/or HIV antibody/antigen combination assay confirmed by a second licensed HIV assay such as a HIV-1 Western blot confirmation or HIV rapid multispot antibody differentiation assay.  NOTE: The term "licensed" refers to a kit that has been certified or licensed by an oversight body within the participating country and validated internally (e.g., United States [U.S.] FDA) WHO (World Health Organization) and CDC (Centers for Disease Control and Prevention) guidelines mandate that confirmation of the initial test result must use a test that is different from the one used for the initial assessment. A reactive initial rapid test must be confirmed by either another type of rapid assay or an E/CIA that is based on a different antigen preparation and/or different test principle (e.g., indirect versus competitive), or a Western blot or a plasma HIV-1 RNA viral load  HIGH-RISK STRATUM: Age >= 18 years  Because no dosing or adverse event data are currently available on the use of nivolumab in participants < 18 years of age, children are excluded from this study HIGH-RISK STRATUM: Eastern Cooperative Oncology Group (ECOG) performance status =< 2 (Karnofsky >= 50%) HIGH-RISK STRATUM: Life expectancy of greater than 6 months HIGH-RISK STRATUM: Hemoglobin > 10 g/dL (within 2 weeks before enrollment) HIGH-RISK STRATUM: Absolute neutrophil count: >= 1,500/mm^3 (within 2 weeks before enrollment) HIGH-RISK STRATUM: Platelets: >= 100,000/mm^3 (within 2 weeks before enrollment) HIGH-RISK STRATUM: Total bilirubin: < 2 X upper limit of normal (ULN) (within 2 weeks before enrollment) HIGH-RISK STRATUM: Aspartate aminotransferase (AST) (serum glutamic oxaloacetic transaminase [SGOT]) / alanine aminotransferase (ALT) (serum glutamic pyruvic transaminase [SGPT]): =< 2.5 X institutional ULN (within 2 weeks before enrollment) HIGH-RISK STRATUM: Albumin >= 3.0 g/dL (within 2 weeks before enrollment) HIGH-RISK STRATUM: Creatinine levels =< 1.5 X normal institutional limits; or calculated creatinine clearance must be > 50 ml/min (within 2 weeks before enrollment)  HIGH-RISK STRATUM: Females of childbearing potential (FOCBP) must agree to follow contraception requirements:  The effects of nivolumab on the developing human fetus are unknown. For this reason and because other therapeutic agents used in this trial are known to be teratogenic, FOCBP must agree to use adequate contraception (hormonal or barrier method of birth control; abstinence) before study entry, for the duration of study participation and 5 months after completion of nivolumab administration. Should a woman become pregnant or suspect she is pregnant while she is participating in this study, she should inform her treating physician immediately  NOTE: A female of childbearing potential is any woman, regardless of sexual orientation or whether they have undergone tubal ligation, who meets the following criteria: 1) has achieved menarche at some point, 2) has not undergone a hysterectomy or bilateral oophorectomy; or 2) has not been naturally postmenopausal (amenorrhea following cancer therapy does not rule out childbearing potential) for at least 24 consecutive months (i.e., has had menses at any time in the preceding 24 consecutive months) HIGH-RISK STRATUM: Participant must have a CD4 count of >= 100 cells/uL at least 2 weeks prior to enrollment OR >= 100 cells/uL before receiving prior CRT, as CD4 may be low due to the effects of CRT HIGH-RISK STRATUM: Participant must be on a stable antiretroviral therapy (ART) regimen for at least 2 weeks prior to enrollment with no intention to change the regimen within 12 weeks after enrollment HIGH-RISK STRATUM: Participant must have an HIV RNA viral load of < 200 copies/mL HIGH-RISK STRATUM: Participant must have received at least 54 Gy of radiation to the PTVp (primary) and 45 Gy to PTVn (elective nodal region) for the treatment of the anal cancer within 9 weeks before enrollment  HIGH-RISK STRATUM: Participant must have =< grade 2 diarrhea  Participants with grade 1 or grade 2 diarrhea are eligible provided stool for ova/parasites and stool cryptosporidium studies are negative HIGH-RISK STRATUM: Purified protein derivative (PPD) negative. Alternatively, the QuantiFERON-tuberculosis (TB) Gold In-Tube (QFT-GIT) assay (Cellestis Limited, Carnegie, Australia) can be used. An individual is considered positive for M. tuberculosis infection if the interferon (IFN)-gamma response to TB antigens is above the test cut-off (after subtracting the background IFN-gamma response in the negative control). The result must be obtained within 20 weeks prior to enrollment. PPD positive (or QuantiFERON assay positive) participants are permitted if prophylaxis has been completed prior to enrollment  HIGH-RISK STRATUM: Participants with impaired decision-making capacity (IDMC) may be eligible for the study provided all other eligibility criteria are satisfied:  The participant's legally authorized representative (LAR) is able and willing to sign consent in addition to the study candidate Both participant and LAR agree to follow study parameters per protocol  HIGH-RISK STRATUM: The participant, in the opinion of the treating investigator, is able to receive IV contrast injections:  All participants in the High-risk Stratum must have an oral contrast (rectal contrast optional) and IV iodine contrast abdomen and pelvis contrast computerized tomography (A/P C+CT) and chest C+CT at baseline and for all clinical follow up time points. Imaging centers should follow their local routine guidelines for determination of patient eligibility for IV contrast injection and appropriate post contrast follow up renal function determinations SCREENING ELIGIBILITY LOW-RISK STRATUM: Participant is able to understand and willing to sign a written informed consent document  SCREENING ELIGIBILITY LOW-RISK STRATUM: Age >= 18 years  Because no dosing or adverse event data are currently available on the use of low-dose radiation concurrent with mitomycin-C/fluorouracil (5-FU) or mitomycin-C/capecitabine in participants < 18 years of age, children are excluded from this study SCREENING ELIGIBILITY LOW-RISK STRATUM: Participant must have histologically proven T1-2N0M0 invasive anal canal or anal margin squamous cell carcinoma with tumors measuring =< 4 cm within 6 weeks before pre-registration. Measurable disease is not required. Participants with tumors of non-keratinizing histology such as basaloid, transitional cell, or cloacogenic histology are permitted. Participants who are status/post local excision or excisional biopsy procedure are eligible provided there was tumor involvement of the anal canal and/or anal verge prior to the reaction, if the margins were positive, and/or if the stage is T2N0 based on tumor size before the procedure. This means that participants with T1N0M0 anal margin squamous cell carcinoma who underwent surgical excision with negative margins and no involvement of the anal verge and/or anal canal are not eligible Baseline imaging including, fludeoxyglucose F-18 (FDG)-positron emission tomography (PET)/CT and A/P C+CT must be submitted for central review for confirmation of no lymph node involvement. Results of central review (including discrepancies between local read and central review) will be returned to the site within 5 business days of submission, allowing participants with imaging suspicious for lymph node (LN) involvement determined by central review to undergo a fine needle aspirate (FNA) or core biopsy at their local center confirming no lymph node involvement (N0) for eligibility  SCREENING ELIGIBILITY LOW-RISK STRATUM: HIV positive. Documentation of HIV-1 infection by means of any one of the following:  Documentation of HIV diagnosis in the medical record by a licensed health care provider. If the record contains information that the patient is taking FDA-approved combination therapy for HIV infection, then this can be part of the record substantiating the HIV positive diagnosis HIV-1 RNA detection by a licensed HIV-1 RNA assay demonstrating > 1000 RNA copies/mL  Any licensed HIV screening antibody and/or HIV antibody/antigen combination assay confirmed by a second licensed HIV assay such as a HIV-1 Western blot confirmation or HIV rapid multispot antibody differentiation assay.  NOTE: The term "licensed" refers to a kit that has been certified or licensed by an oversight body within the participating country and validated internally (e.g., U.S. FDA) WHO (World Health Organization) and CDC (Centers for Disease Control and Prevention) guidelines mandate that confirmation of the initial test result must use a test that is different from the one used for the initial assessment. A reactive initial rapid test must be confirmed by either another type of rapid assay or an E/CIA that is based on a different antigen preparation and/or different test principle (e.g., indirect versus competitive), or a Western blot or a plasma HIV-1 RNA viral load SCREENING ELIGIBILITY LOW-RISK STRATUM: Tumor size must be documented by digital rectal exam and anoscopy/proctoscopy within 6 weeks prior to pre-registration SCREENING ELIGIBILITY LOW-RISK STRATUM: Life expectancy of greater than 6 months LOW-RISK STRATUM: Participant satisfies all criteria in Eligibility for Screening Low-Risk Stratum. Participants with imaging suspicious for LN involvement determined by central review must undergo a fine needle aspirate (FNA) or core biopsy confirming no lymph node involvement (N0) LOW-RISK STRATUM: ECOG performance status =< 2 (Karnofsky >= 50%) LOW-RISK STRATUM: Hemoglobin > 10 g/dL (within 2 weeks before enrollment) LOW-RISK STRATUM: Absolute neutrophil count: >= 1,500/mm^3 (within 2 weeks before enrollment) LOW-RISK STRATUM: Platelets: >= 100,000/mm^3 (within 2 weeks before enrollment) LOW-RISK STRATUM: Total bilirubin: < 2 X ULN (within 2 weeks before enrollment) LOW-RISK STRATUM: AST (SGOT) / ALT (SGPT): =< 2.5 X institutional ULN (within 2 weeks before enrollment) LOW-RISK STRATUM: Albumin >= 3.0 g/dL (within 2 weeks before enrollment) LOW-RISK STRATUM: Serum creatinine levels =< 1.5 X ULN or calculated creatinine clearance must be > 50 ml/min (within 2 weeks before enrollment)  LOW-RISK STRATUM: Participant must agree to follow contraception requirements:  Females of childbearing potential (FOCBP) and sexually active males must be strongly advised to use accepted and effective method(s) of contraception or to abstain from sexual intercourse for the duration of their participation in the study and for at least 6 months after the completion of treatment NOTE: FOCBP is defined as a sexually mature woman, regardless of sexual orientation or whether they have undergone tubal ligation who: 1) has not undergone a hysterectomy or bilateral oophorectomy; or 2) 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 LOW-RISK STRATUM: Participant must have a CD4 count of >= 100 cells/uL at least 2 weeks before enrollment LOW-RISK STRATUM: Participant must on a stable ART regimen for at least 2 weeks before enrollment and receive appropriate care and treatment for HIV infection under the care of a physician experienced in HIV management LOW-RISK STRATUM: Participant has a HIV RNA viral load of < 200 copies/mL  LOW-RISK STRATUM: Participant has started an alternative anti-coagulant regimen within 2 weeks prior to enrollment if taking warfarin and considering capecitabine  NOTE: Low molecular weight heparin is permitted provided the participants prothrombin time (PT)/international normalized ratio (INR) is < 1.5 LOW-RISK STRATUM: Participant must agree to having phenytoin levels checked weekly if planning to receive capecitabine while taking phenytoin for a seizure disorder  LOW-RISK STRATUM: Participants with IDMC may be eligible for the study provided all other eligibility criteria are satisfied:  The participant's legally authorized representative (LAR) is able and willing to sign consent in addition to the study candidate Both participant and LAR agree to follow study parameters LOW-RISK STRATUM: The participant, in the opinion of the treating investigator, is able to receive IV contrast injections:  All participants in the Low-risk Stratum must have an oral contrast (rectal contrast optional) and IV iodine contrast CT (A/P C+CT and chest C+CT) at baseline and for all clinical follow up time points. Imaging centers should follow their local routine guidelines for determination of patient eligibility for IV contrast injection and appropriate post contrast follow up renal function determinations  Exclusion Criteria:  HIGH-RISK STRATUM: Any live vaccines within 30 days prior to enrollment  Examples of live vaccines include, but are not limited to, the following: measles, mumps, rubella, chicken pox, yellow fever, rabies, Bacillus Calmette-Guerin (BCG), and typhoid (oral) vaccine. Seasonal influenza vaccines for injection are generally killed virus vaccines and are allowed; however, intranasal influenza vaccines (e.g., Flu-Mist) are live attenuated vaccines and are not allowed NOTE: No live vaccines may be administered while participating in the trial. HIGH-RISK STRATUM: Participant has known interstitial lung disease that is symptomatic or may interfere with the detection or management of suspected drug-related pulmonary toxicity HIGH-RISK STRATUM: Prior treatment with an immune checkpoint in