I'm not sure, but I think you are right on both of your questions. 1. "time" is a noun, so "the next time" is probably a noun phrase the phrase "the next time" tells when a verb happens, so it acts as an adverb 2.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.