Yes, it is ok if you drift off to sleep while listening. Your subconscious mind does not sleep and it will continue to absorb all of the affirmations given to it.
Subliminals are messages that are below the threshold of conscious perception, and they work by influencing the subconscious mind.
You can use subliminals to help you sleep better by embedding positive affirmations into your music or audio recordings that you listen to while you sleep.
The affirmations will then be absorbed by your subconscious mind, and this will help you to sleep better.