The U.S. National Renewable Energy Lab did a study of solar installations in the U.S. in 2013 and determined that for large-scale solar PV systems, 7.9 acres (31,970 $m^2$) of land are required on average for 1 $MW_{ac}$ of power capacity (from Table ES-1). This is based on analysis of 72% of existing installations in the country, so this is a good real-world estimate of how much space is required in practice. Because this is looking at capacity, this space estimate will translate to any location. Generation is a different question, of course.
According to the IEA, world energy use in 2020 was 606 exajoules, or 168,333 TWh. (Note that this includes oil and gas, not just electric energy.)
I used PVWatts to see how much energy a solar array in the Sahara can produce. Unsurprisingly there aren't a lot of weather stations in the Sahara, so I used Aswan, Egypt as a proxy -- wrong longitude, right latitude. Here, a 1.2 $MW_{dc}$ array would produce 1 $MW_{ac}$ capacity and 2,204 MWh of energy. To get to the global consumption, we'd need 76,375,545 of these, covering an area of 2,441,741 $km^2$.
The Sahara Desert is 9.2 million $km^2$, so this represents about 27%.