The Contempt of Court Act 1981 covers several types of offences but is particularly important for governing how criminal proceedings are reported
legislation.gov.uk/ukpga/1981/49/…
If they are, people can be wrongly convicted/acquitted or trials have to be stopped and restarted
Before that happens it's a free for all, and you'll notice the number of articles on a case drop and details get cut
They stay in force for as long as the judge wants, normally until a fixed point like the end of another case
So yes, that includes social media
It's punishable by up to two years imprisonment but it's rare for people to get the full sentence without severe aggravating factors like malice or a particularly high profile publication
The problem is that few other people know what they are and social media and the internet more widely can make reporting restrictions essentially redundant
So many people are committing contempt on social media it would be unfeasible for them all to be identified or prosecuted