As mentioned: Necrozma can only fuse with Solgaleo and Lunala.
To build on this, Necrozma, Solgaleo, Lunala make up the "Light Trio." These Pokemon (and their pre-evolutions) can both create and destroy Ultra Wormholes.
Quote from Bulbapedia (Article: Light Trio):
According to a book called "The Light of Alola" found in Malie Library, a SolgaleoSUS/LunalaMUM appeared in Alola many years ago through an Ultra Wormhole.
(Article: Ultra Space)
In ancient times, Necrozma's light shone through the Ultra Wormholes connecting to various worlds such as the Ultra Beasts' homeworlds, Ultra Megalopolis, and the Pokémon world, primarily over the Alola region. However, following an incident with the residents of Ultra Megalopolis years ago, Necrozma's body was damaged and it lost the ability to produce light, the agony caused by its injuries sending it into a berserk state where it constantly hungered for light.
From these connections, the energy Necrozma absorbs seems to be connected to the ability to create Ultra Wormholes as well as produce light. From my guess, Necrozma can only absorb powers that it knows how to use. Since Necrozma shares a few abilities with Solgaleo and Lunala, it would seem that they are the only Pokémon he can fuse with.
I would assume Necrozma could also fuse with Cosmog if so desired, but the benefits would be so minimal it would be basically pointless.