The temperature of space near earth is about as 10 degrees Celsius, but much cooler in interstellar space.
It depends. A better value is 5.2 degrees Celsius, and that assumes a macroscopic perfect blackbody that rotates rather quickly. The temperature of a sub-microscopic object in near Earth space would more likely be in the tens of thousands of degrees. Compare those values with the Spitzer Space Telescope, whose ambient temperature is about 30 kelvins.
The reason the temperature of a sub-microscopic object is so high is because interactions with other sub-microscopic objects bring those tiny objects to thermal equilibrium with the warm interplanetary medium. There are regions of intergalactic space where the very rare material that fills that space is in the millions of kelvins.
Despite being surrounded by material whose temperature is in the millions of kelvins, a macroscopic object in intergalactic space would cool to 2.7 kelvins because the intergalactic medium is so very, very sparse that thermal radiation dominates many over against the tiny amount of warming that results from contact with that material.
The reason a macroscopic blackbody is about 5.2°C (278.3 kelvins) is because such an object effectively absorbs sunlight on one quarter of its surface (halved because half of the surface is in darkness, and halved again because the surface area of a hemisphere is twice its cross section), but emits thermal radiation from all of its surface. This, combined with the Stefan-Boltzmann law yields an effective blackbody temperature of 278.3 kelvins at one astronomical unit.
The reason the Spitzer Space Telescope has a much lower ambient temperature is because it is not a blackbody. The Spitzer is essentially tidally locked, with one part always facing the Sun. The parts of the Spitzer that are exposed to sunlight are coated with a highly reflective surface, making the Spitzer absorbs very little incoming sunlight. The parts of the Spitzer that are self-shaded from sunlight are coated with a very black surface, making those parts radiate very efficiently into empty space. The very sparse nature of the warm interplanetary medium essentially has no effect on the Spitzer's temperature.
The end result is that passive thermal techniques alone keep the Spitzer a rather cool 30 kelvins. That's too warm for some of Spitzer's more sensitive instruments. The operation of those instruments required active thermal cooling techniques. Those instruments were powered down when the liquid helium used for that active cooling ran out. The less sensitive instruments continue running to this day.