Possible lymph nodes
Tonsils are lymph nodes--the structures that hold many cells of our immune system. They can get enlarged as a response to infection.
There are glands in the neck often called 'swollen glands' when enlarged, so often the two go together and both can feel sore if inflamed. Strep throat
and many viruses can cause this. Cancer
is rare for what you describe, but i strongly recommend seeing your doctor.