First, start playing whatever you feel like listening to. Then, close the Apple Music app and open the Clock app. Go to the Timer tab, click When Timer Ends, then scroll all the way down to the bottom and select Stop Playing. Set the timer for however long you need, and click Start.
When that timer runs out, the music will stop playing. Since the Clock app remembers your settings, the next time you want to set a sleep timer for Apple Music, it’ll be on Stop Playing unless you change it to something else.