the good thing about teaching is that you're able to bounce between the two
when you achieve QTS (qualified teacher status) you will have a age specialism (e.g. 3-7 or secondary) but having qts means you are able to teach in a primary school or a secondary irrespective of your specialism
so if you did a primary education with qts degree and work in a primary and want to swap to secondary you technically can - the tough part is showing headteachers you're a better option to hire than a subject specialist!
because of this reason and due to the subject knowledge required on individual subjects it's sometimes harder going from secondary to primary
to teach secondary you need to have a strong passion for one subject (e.g. maths) as it will be your timetable 24/7. you won't experience any other subjects and it will be your sole focus. the age of the children is also different and your focus would be more on promoting independent learning etc. you'll also usually repeat lessons in a day to several classes across a year group and not have the same class
whereas primary you will have a varied timetable and have your class of children that you can get to know really well. however, your subject knowledge needs to be good across all subject areas
my advice would be to think of a subject you really love and would like to explore at degree level. apply for this degree, and if possible do it as a joint honours with education studies (e.g. mathematics and education studies)
although if you want to do a single subject degree then that's ok too! this way you can focus on developing your experience and skills across secondary and primary settings and decide which you prefer - then you can apply for either a primary or secondary pgce.
if you picked secondary pgce and did secondary for a while and disliked it, i do know a lot more teachers that have gone from being secondary teachers to primary than i have primary teachers to secondary. although, if you did a primary pgce with a maths degree for example you could persuade a headteacher you have the necessary subject knowledge to teach at secondary level. if you train with a degree in primary ed with qts you obviously will find it harder to get a secondary teaching job but will be qualified within the three years (so if you're desp to teach and eager to start asap it may be better). some secondaries hire primary qualified teachers to work within the learning development/SEN teams or work with children who need additional support - so this is something you can look into
get into teaching and other establishments offer subject knowledge courses (specifically for subejcts with teacher shortages such as physics and computing) so you can look into these if you qualify as a primary and want to go into secondary instead, but again, you may be up against someone with a degree in the subject so it's really dependent on the circumstance
or, alternatively, you can look at working in some of the very few middle schools left around the country (there really isn't many and i would assume getting a job in one would be tough - but definitely possible)
hope this helps and makes sense, let me know if you need any help