Travel with a friend, a friend who understands your anxiety and can help keep possible said people at bay. (hug blocker if you will) Most people can be pretty understanding if you just tell them your not comfortable with contact or things. Friends can usually help block you from pushy people. They can also give harassers a piece of your mind for you when someone steps out of line. I understand anxiety prevents you from saying the things u want to just to hopefully avoid anything further, and it is a harder barrier to get around. But if you have someone there by your side, you can at least lesson it.
Try small cons first. I would definitely avoid large cons for a while until you can mentally prepare yourself for that kind of large crowd.
I am constantly asked for hugs and photos from/with people at cons and tbh its usually perfectly fine. The people I’ve dealt with have always been really nice about it and understanding. Most will even ask if it’s ok to touch your shoulder during a selfie before they do just to make sure it’s something your comfortable with.
This is not going to be the same for everyone, as there are some really rude pushy people. But that’s why travelling with a buddy and not alone is a good thing. Or even with a group of your friends could be even better. Either way, take it slow and find yourself a “safe spot” in the con where you can give yourself room to breathe and recuperate yourself away from the crowd and noise. Sometimes being in a situation your not used to can cause u to have a panic or anxiety attack and so long as you can get yourself a spot where you can calm down and relax it will help you more than you could ever imagine.
I hope this helps or at least gives you at least some ideas.
Have fun cosplaying and take care of yourself and even more importantly, your mind. =)