Among patients with ESRD, cancer risk is affected by kidney dysfunction and by immunosuppression after transplant. Assessing patterns across periods of dialysis and kidney transplantation may inform cancer etiology. We evaluated 202,195 kidney transplant candidates and recipients from a linkage between the Scientific Registry of Transplant Recipients and cancer registries, and compared incidence in kidney function intervals (time with a transplant) with incidence in nonfunction intervals (waitlist or time after transplant failure), adjusting for demographic factors. Incidence of infection-related and immune-related cancer was higher during kidney function intervals than during nonfunction intervals. Incidence was most elevated for Kaposi sarcoma (hazard ratio [HR], 9.1; 95% confidence interval (95% CI), 4.7 to 18), non- Hodgkin's lymphoma (HR, 3.2; 95% CI, 2.8 to 3.7), Hodgkin's lymphoma (HR, 3.0; 95% CI, 1.7 to 5.3), lip cancer (HR, 3.4; 95%CI, 2.0 to 6.0), and nonepithelial skin cancers (HR, 3.8; 95%CI, 2.5 to 5.8). Conversely, ESRD-related cancer incidence was lower during kidney function intervals (kidney cancer: HR, 0.8; 95%CI, 0.7 to 0.8 and thyroid cancer: HR, 0.7; 95%CI, 0.6 to 0.8).With each successive interval, incidence changed in alternating directions for non-Hodgkin's lymphoma, melanoma, and lung, pancreatic, and nonepithelial skin cancers (higher during function intervals), and kidney and thyroid cancers (higher during nonfunction intervals). For many cancers, incidence remained higher than in the general population across all intervals. These data indicate strong short-term effects of kidney dysfunction and immunosuppression on cancer incidence in patients with ESRD, suggesting a need for persistent cancer screening and prevention.