Cancer can affect renal function in multiple ways. Direct involvement of the kidneys occurs in renal cell carcinoma, where cancer originates in the kidneys. Secondary effects can happen due to metastasis of other cancers to the kidneys. Additionally, chemotherapy and other cancer treatments can have nephrotoxic effects, potentially leading to acute or chronic kidney injury.