When my aunt was doing her GCSEs she had similar issues and ended up getting a C then took science subjects at A level and got an E and nearly failed, got an E in maths as well.
Eventually she changed her stream and left STEM behind for many years but always regretted that she should have done better. When her own child was doing GCSEs she decided to learn the subject again so she could help them. She was always going on about how the subject was so easy and always wondered what went wrong before. She even helped other kids with their GCSEs for science and maths and eventually started giving tuition and went further to learn A level content by herself. A few years later she joined a secondary school as a teacher and is now head of department for Maths. I wouldn't have believed the story if she wasn't my aunt and I wouldn't have seen her transcripts but it's true. Even after all that she still regrets she didn't push herself in the past but does make sure to push all the kids she is teaching.
The possibility of finishing your education or improving is always there. Your teacher should have pushed you to stay in set 5 or moved you to a better set. It is possible they were new in the profession or they might be too empathetic to the emotional distraught you were feeling that they thought it was better for you to move away from the situation.
One of the girls in my school was moved from triple science higher to combined higher. She was doing quite badly due to her being continuously bullied. She was also moved down in the maths set. The school could have moved the bully but they decided to move her. Reasoning was simply that her anxiety was stopping her from learning and a lower set would benefit. In the end, she did end up scoring the highest in the school but the way I take this is that school would always end up removing the victim and moving them to disadvantage them further. Might work for some and not for others. Bullying has always been there and schools really need to be better at tackling it rather than just doing the minimum.
I am glad it worked for you with Maths and if you are good at it then you can be good at science too. When the time is right, enrol and have another go at science GCSE.