Submarines are just as safe or even safer than a ship above the water.
Submarines go through rigorous testing and approval before they are allowed to go into the water with people.
Also the captain of the submarine goes through a lot of training on how to operate the submarine safely so you're likely safer in a submarine than you are in your car or truck on a freeway.
My dad has been in a submarine and at first it worried him but then later he found it fun and said he preferred to be in the submarine below water than to be on a ship above water.
On long term submarine missions people do sleep on the submarines below water.
On the submarine there are beds but there are not a lot of beds on a submarine.
Beds on a submarine are in pretty short supply but they do have have some bunk beds on submarines.
On other submarine missions that only last 8 hours or less the people then come back to land and then sleep somewhere else.
But if the people on the submarine need to sleep overnight on an overnight or longer submarine mission they can do so.
The bunk beds that are on submarines are not the most comfortable though and they are in very tight quarters so if you're claustrophobic then sleeping on a submarine is not for you.