Description from @unknown
Getting out of bed after sleep, the player can get up in some incomplete blocks, leaves, glass, beacon and some other blocks.
It can happen by accident. The player does not always stand in these blocks. To accurately reproduce this problem, you need to build a small structure. More details in steps to reproduce. And I will give a list of blocks in which the player may find himself getting out of bed.
Chests
Glass
Shulker Box
Leaves
Beacon
TNT
Lectern
Composter
Cauldron
Anvil
Brewing Stand
Azalea
Pointed Dripstone
Big Dripleaf
Dragon Egg
Grindstone
Steps to reproduce:
Build the structure as shown in the image.
[media]Place the affected block in place of the diamond block (list above).
Go to sleep.
Get out of bed.
Observed results:
The player will be inside the block.
Expected results:
When the player gets out of bed, he must not get inside the blocks.
Video:
[media]Original Description
When I fell asleep it turns out that when I wake up, he directs me to the side of the bed but inside or on the chest
Related issues
is duplicated by
Attachments
Comments

I confirm. I did a little research on this issue.
Description from @unknown
Getting out of bed after sleep, the player can get up in some incomplete blocks, leaves, glass, beacon and some other blocks.
It can happen by accident. The player does not always stand in these blocks. To accurately reproduce this problem, you need to build a small structure. More details in steps to reproduce. And I will give a list of blocks in which the player may find himself getting out of bed.
Chests
Glass
Shulker Box
Leaves
Beacon
TNT
Lectern
Composter
Cauldron
Anvil
Brewing Stand
Azalea
Pointed Dripstone
Big Dripleaf
Dragon Egg
Grindstone
Steps to reproduce:
Build the structure as shown in the image.
[media]Place the affected block in place of the diamond block (list above).
Go to sleep.
Get out of bed.
Observed results:
The player will be inside the block.
Expected results:
When the player gets out of bed, he must not get inside the blocks.
Video:
[media]
Only happens for me if the bed is placed along the X axis.

This also effects 1.18.2

Villagers have the same bed exiting behavior, which I have confirmed at MCPE-142544. The game is using similar logic for exiting beds that it uses when checking for block collisions during environmental spawning. It
finds a spot where there is a solid top surface underneath and no solid blocks colliding with the mob, then
offsets the mob based on collisions with full blocks at that spot, then
allows collisions with non-solid blocks at the offset position.