I’ll add to some of the other responses, linking some images that may be helpful to clarify what’s going on. First off, we can graph the energy from the sun that hits earth to see how much of each wavelength of light we’re working with. The industry standard graph is called AM1.5, and it looks something like [this](https://cnx.org/resources/5c23fc928d34f39f76cf239208c0b86ab90bb5a3/graphics1.jpg). As you can see, there’s a lot of energy coming from frequencies around visible light, and less coming from farther out in the infrared and very little from ultraviolet.
It’s also worth clarifying that shorter wavelengths of light (to the left on the x axis) carry more energy *per photon* than longer wavelengths.
Now we come to solar photovoltaic (PV) panels. To oversimplify, they generate electricity by using a photon of light to bump an electron up an energy level. The amount of energy it takes to do this is a property of the base material, called it’s band gap. Photons that don’t have enough energy (have wavelengths too long) can’t get an electron over that gap, and so provide no electrical energy. [here](https://www.solarquotes.com.au/blog/wp-content/uploads/2017/08/pvspectrum.jpg) is a visualization of this on the AM 1.5 graph. Note that everything to the right of the band gap is wasted. So, it would appear that the best solar cells would use materials with a very small band gap, so we can use the largest possible fraction of the light that hits the cell.
Unfortunately, when an electron makes that jump, we can only get the amount of energy equivalent to what it took to bump the electron up and over the band gap. Shorter wavelength photons that carry excess energy can only contribute a small portion to electrical energy; the rest is wasted as heat. So, what we actually want is a material with a bandgap small enough to allow us to capture a large percentage of the available light, but still big enough to allow us to use a large portion of the energy from the more plentiful, higher energy visible light. [here](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSuzowDUCeliBZ_SDUNg6Y_4jEIDMAsbxefhg&usqp=CAU) is a visualization of that tradeoff. Luckily, as we can see, among some of the more exotic materials, there’s also a very common industrial material, silicon (Si) right near the peak of efficiency. This is why most solar panels use silicon cells. It’s also worth noting that the particular size of the silicon bandgap allows it to use a portion of the infrared light, as well as the visible and UV.
Now, there’s one more wrinkle. If we don’t care about electrical energy, and instead, we want just heat energy, all we need to do is have a totally absorbtive (black) surface across all wavelengths. This is pretty easy to do, but heat is less useful and harder to transport or store than electricity. But if heat’s what you need, there’s potentially a lot more solar energy available for the taking! An example [here](https://www.youtube.com/watch?v=FKhszB4E1_M).
Latest Answers