Hello. I am no expert but maybe I could give my 2 cents. Basically, I think you can either:
A) Practice not hitting the 5th string with your thumb resting/hovering on the 6th string, or
B) rest your thumb on the 5th string so that you don't hit it during your rasgueo.
I've seen people do it both ways and both ways work. Personally, I just like to leave my thumb on the 6th string so that I don't have to worry about moving it to the 5th -- it is not that difficult to avoid hitting the 5th string, and even if you do by mistake, it's not that big a deal imo. It is probably good practice to get used to resting your thumb on the 6th string and avoid hitting the 5th. Of course, you can rest your thumb on the 5th string so that you only hit strings 1-4, especially if you are doing a lot of continuous rasgueo and don't want any of the harmony/resonance from the 5th string.
Consider this video of (a very young) Paco playing "Impetu" by Mario Escudero:
From 2:28 to 2:33, Paco rests his thumb on the 6th string while he does a bunch of i-i rasgueos on the trebles
From 2:33 to 2:37, he rests his thumb on the 5th string
Then from 2:37 to 2:41, he puts his finger back on the 6th string