score:11
Someone with a student visa who attempts to enter the UK for reasons other than study is not supposed to be be admitted because the person does not meet the visa conditions.
I assume that your friend has applied to "switch" to another visa while remaining in the UK (please let me know if this is incorrect).
On the UK's page concerning switching to a skilled worker visa, you can read this message:
You must not travel outside of the UK, Ireland, the Channel Islands or the Isle of Man until you get a decision. Your application will be withdrawn if you do.
What this means is that someone switching to this visa who leaves before receiving a decision will have to make an entirely new visa application at a UK consulate and wait for that new application to be successful before being able to return to the UK.
The same warning is present for other visa types as well, for example the health care worker visa.
Could he get into trouble at the border control when going back to the UK because of that?
Yes.