Is the swelling of the ankles pitting or non-pitting?
When you press down on the skin for a bit, does it stay indented (pitted)?
Non-pitted swelling wouldn't have any marks left, nothing persistent.
Some people with hyperthyroidism will develop edema around the ankles that's typically non-pitting. Elevate the legs to help blood return. You did mention painful glands in the neck; thus, I thought hyperthyroid perhaps.
Have you used any thyroid drugs or supplements in the past? Do you have any conditions that you're aware of that are worth mentioning?