Can I wear tampons to bed safely??

If I change it as soon as I’m going to sleep and as soon as I wake up (usually I get 5-6 hours of sleep) can I safely wear them to bed?