xxxxxxxxxx
This works only on Java Edition of Minecraft
/give @s minecraft:player_head{SkullOwner:"<username>"}
Example - /give @s minecraft:player_head{SkullOwner:"Swanith"}
xxxxxxxxxx
/give @p minecraft:player_head{SkullOwner:"<PlayerName>"}
or
/give @p minecraft:player_head{SkullOwner:"Dream"}