なければならない vs なきゃいけない — same energy, different vibe?

still technically N5 but binge-watching ahead of my level lol. My textbook has 宿題をやらなければならない and then a character in my show says something like 準備しなきゃ. Are these literally the same grammar just dressed differently, or is there a rule I should know before I start saying なきゃ out loud in class?
Post
沐學 Mizuru