A study of more than 45,000 Norwegian university students has shown that using screens in bed is strongly associated with insomnia symptoms and lower sleep duration. Researchers suspect that this is because screen time displaces sleep by taking up time when people would otherwise be resting. However, using social media was not found to be more harmful than other forms of screen use.
They could have had them not use a screen for some of the study and use it for others, but after reading the article and skimming the paper I can’t see any indication they did this. It seems they just sent out a survey and concluded people who use their phones in bed go to sleep later so that must be the cause.