You might be plain OP but I doubt you see actively ugly - it's an unusual thing to be.
Your comment about having a fat middle does support the idea that you may not be entirely objective about this - you might carry some fat around your middle but at a size 8 it's at a level that's VERY easy to disguise with clothes.
Assuming you are fairly plain, then age will shortly level things out further, so hang onto that.
Being blunt, at the age of 40 if you are overlooked socially and at work, this is a confidence not a looks issue. Unless you work in a v appearance orientated industry no one is going to be giving a shit what you look like.
Of course it's nice to be good looking at any age, but it matters a lot less as we age.
Stop worrying about what people are thinking when they look at you, because they aren't (they might if you had a deformity, you don't) -and crack on with living your life.
Go and see your GP about low confidence and anxiety, they will be able to put you on an (admittedly long) list for counselling.
Borrow some books from the library about building up confidence and follow the advice that resonates with you, make a plan to stretch yourself a bit, each week.
Do something about one aspect of your appearance you'd like to improve - sounds like it's your hair, so watch some YouTube videos and get an over the counter dye. Or if you have a hairdresser training school near you they may do highlights and haircuts for a nominal fee - if not an over the counter dye will help.
If you don't want to be in photos, don't. My mum avoided them - she was perfectly average looking, she just didn't like them. I don't really like my teeth so always keep my mouth shut, if that helps.
Do keep in mind the Victorian mantra that no one is looking at you, it is true. It would be madness, at 40, to let the fact you are nothing to look at ruin your life.