My S20Ultra has always got hot when using the RAM to the max. This is quite normal. However if you're too concerned contact support and they can walk you through a system check to check your phones highest temp.
Mine only got hot when I installed the beta 3 UI and wS using a particular theme from the theme store. Once I restart the phone and change the theme to normal before the restart, I was able to use the theme and no more over heating.