It's okay! Everyone slips up from time to time, even those of us who do do this for a living. The best thing to do if you use the wrong pronoun for someone is to say something right away, like "Sorry, I meant she." If you realize your mistake after the fact, apologize in private and move on.
A lot of the time it can be tempting to go on and on about how bad you feel that you messed up or how hard it is for you to get it right. But please, don't! It is inappropriate and can make the person who was mis-gendered feel awkward and responsible for comforting you, which is not their job. It is your job to remember people's personal gender pronouns (PGPs). Take an active role in your education.
In your classes, you may hear one of your students using the wrong pronoun for someone. In most cases, it is appropriate to gently correct them without further embarrassing the individual was has been mis-gendered. This means saying something like "Actually Xena uses the pronoun she or they," and then moving on. If other students or faculty are consistently using the wrong pronouns for someone, do not ignore it! It is important to let your student or classmate know that you are their ally.
It may also be appropriate to approach them and say something like, "I noticed that you were getting referred to with the wrong pronouns earlier, and I know that can be hurtful. Would you be okay with me taking them aside and reminding them about your personal pronouns? I want to make sure that this group/class is a safe space for you." Follow up if necessary, but take your cues from the comfort level of your student or classmate. Know that your actions will be appreciated.