Not the person you asked, but a native Spanish speaker myself. The formal way to say "excuse me" (for example to a teacher or boss, or to a stranger on the street if you wish to be polite) would be "disculpe señor/a", or "discúlpeme señor/a". You can also remove señor/a and simply say "disculpe" or "discúlpeme" to anyone and it will still carry the same meaning, since the verb in both cases already implies it's about yourself.
The informal way would be "disculpame" or "discúlpame", although in this case adding señor/a sounds way off. You can definitely add a name though, ie, "discúlpame Shads" and that would be okay.
Edit: as for your specific request of an adult teacher asking something to the students, that would depend a lot on the relationship they have, some teachers are distant while others get more familiar with time. I've seen both. By all means the formal one would always be correct. I've seen teachers with a usually more relaxed or casual approach revert to the formal when they are getting serious or upset.