Cancer can affect the spinal cord in several ways. It can originate in the spinal cord itself, known as primary spinal cord tumors, or it can spread to the spinal cord from other parts of the body, known as metastatic spinal cord tumors. The presence of a tumor can compress the spinal cord and nerves, leading to various symptoms.