Is it ever explained in universe how the three races can use the same resources?

Solution 1:

The starcraft I manual touches on this:

Resources

In order to build up your army, you will need to collect the raw materials necessary to develop and build your war machines. There are two types of resources. You will need to procure both in order to build your full complement of troops.

Mineral Deposits

The planets along the rim are often dotted with clusters of precious Mineral crystals. These Minerals are smelted down and used to create the armoured hulls of starships, vehicles and personal armour. Even the Zerg require Minerals to harden their carapaces and develop strong teeth and bones. The Mineral crystals take some time to gather, and only SCVs, Drones, and Probes have the necessary equipment to break off bits of the crystals and return them to the proper building.

Vespene Geysers

Vespene gas has an unusually high potential energy rating, and as such it is highly valued for use as a fuel in highperformance engines and energy reactors. The Zerg have adapted themselves to use raw Vespene as a source of nourishment to drive their greatly accelerated metabolisms. Even the Protoss require Vespene to work as a catalyst for their psi-driven machines. Geysers of this powerful green gas can be found on many planets along the Rim, and several space stations have been built over Vespene-rich asteroid belts. A refinery of some sort must be built over an active geyser to process and package the gas for its collection by the different species.

Solution 2:

Not sure if it is explained in the game itself, but it is explained on the wiki, and they quote the SC1 game manual.

Vespene gas is also used by other races. The zerg have adapted themselves to use raw vespene as a source of nourishment to drive their greatly accelerated metabolisms, raw vespene exposure resulting in enhancement of the ultralisks physical capabilities. In contrast, the protoss use vespene as a catalyst for their psi-driven machines.

And Minerals :

Terrans and protoss melt these minerals down to create the armored hulls of starships, vehicles and personal armor. Even the zerg require minerals to harden their carapaces and develop strong teeth.

Sources: minerals and Vespene Gas