I’ll tell you what you should do in UK where I am based, if you’re from the Republic of Ireland I am not sure about the names of the courses, but it should be very similar.
First you can get an undergraduate degree like a Bachelor (BSc) or a Master (MSc) in disciplines like maths, physics, statistics, biology, chemistry. Then you will need to get a PGCE which is a post graduate certificate in education. For this you need to pass an initial selection and you need good reference letters, for example from you university lecturers and good marks in the modules. PGCE is between one and two years (if you do it part time). It is good if you find a school where you can do your practice during the PGCE so to be ready and experienced when you finish it.
Some of my students prefer to do the master, that is the 4 year, because it is more fun, you do a research project, you learn a lot in your last year and it is easier to get into PGCE because of the higher qualification. I hope to have answered completely but if there is an aspect that I missed let me know!