(先生に)お礼を申し上げます。
Hello can someone tell me how this phrase is to be used? Do I say it to the teacher or is this a phrase to use with a 3rd person talking about a teacher?
That phrase is basically used "to the teacher".
Example:
Hey teacher, thanks to you I got a job. I hereby express my gratitude (to you right now).
Similar when you apologize - お詫び申し上げます = I hereby express my apologies.