This phase II trial studies how well erdafitinib works in treating patients with solid tumors, non-Hodgkin lymphoma, or histiocytic disorders that have spread to other places in the body and have come back or do not respond to treatment with FGFR mutations. Erdafitinib may stop the growth of cancer cells by blocking some of the enzymes needed for cell growth.