Sounds like you are not going to be taking too much off the nut to be bothering using a sander, and besides, using an electric sander to shave such a small item ( remember you have to hold it as well ) is fraught with the danger of sanding it uneven.
For such a quick small job, simply put the nut upside down in a vice. I'd use some wood each side of the nut so you dont mark or crush it too much in the metal jaws. Then use a fine grade flat file and make sure to keep the file square. You'll be much more accurate with a flat file because its slow and takes a very small amount off at a time, unlike a sander.
Nuts are not generally permanently glued, unless a previous owner has done that. You could heat up the nut with a heat gun, but be careful on how close you get. You dont want to destroy it. If its a normal nut ( i.e. not been permanently glued ) it should come off ok. In fact many a nut i've removed has not even needed that. Just a gentle tap with a lightweight hammer, and i mean gentle