If you have heat, you have "random" movement of different molecules in your material.
When two different molecules with different velocity vectors interact, they sometimes emit a photon carrying away some of their energy.
This results in the relative kinetic energy of the two molecules being reduced (due to conservation of energy).
This average relative kinetic energy distributed pretty randomly over the substance is what we call "heat". The photons that are radiated and not captured again (by colliding with other molecules in the body) carry energy away from the body.
A decent approximation of the amount and spectrum of the emitted photons is known as the "black body radiation curve" for a given temperature. Here, black refers to "doesn't have a strong unusual absorption/emissions spectrum"; for example, Hydrogen gas has lines in its spectrum caused by the distance between the lowest and 2nd lowest energy state of the electron orbits around the nucleus.
In the local interplanetary medium, there is a large hot heat source 1 AU away (the sun), a few warm heat sources nearby (Earth and the Moon), some teeny tiny far away heat sources (planets and other stars), a low density interplanetary medium that is usually pretty hot (but of such low mass it doesn't really matter), and the cosmic microwave background radiation.
The CMB is at around 3K, and is pretty close to a black body. So if you are warmer than 3K, you'll emit more and higher energy photons than it will emit towards you.
Your interactions with the IPM is going to be tiny, and won't trade much heat.
If you are close to Earth, you'll get warmed to a few degrees above 0 C by trading photons with it (on one side), while getting nothing on the other.
If you are in sunlight, it will be pouring photons at you. Heat is a bigger problem than cold quite often due to the Sun in space; we make things reflective or white in order to reduce the amount of heat we pick up from the sun.
Now there are other effects in space. When air loses pressure, it cools off and water sublimates out of it. So if you had a room at 20C and 1atm and you dropped its pressure to zero, you could see water forming on surfaces (cooler, less dense air causing water to condense), then as the temperature continues to drop that water could freeze.
Humans will emit gasses and fluids when exposed to space, as our flesh isn't designed to put up with a 1 atm gradient. The fluids will boil (from lack of pressure) and cool, and that could result in localized freezing; the phase change from liquid to gas soaks up a lot of Joules, and in the grand scheme, 37C isn't far away from 0C.
On Earth, most heat transfer comes from contact. You interact a lot more with things "touching" you than you do with things far away. That interaction causes photons to be emitted; if the thing you are "touching" is hotter than you, the photons from their internal interactions and the inter-object interactions will be higher energy than the ones you are emitting in turn. And, when the high-velocity "other" molecules average velocity with your slower molecules, they'll directly increase in speed (even as they emit photons).
Between the two of those, you'll heat up if the medium in contact is hotter, or cool down if the medium in question is cooler.
Then, the medium you are interacting with, if a gas or a liquid, will have its density changed by heating up/cooling down. This causes it to stir in such a way that substance with a "more typical" temperature is back in contact with you. This convection process means that you are quickly interacting not just with the matter immediately in contact with you, but with the matter that is in turn swapping positions with it.
The only matter "in contact" in space is the interplanetary/interstellar medium, and its density is so low that the rate of heat transfer is tiny compared to radiation coming off most macroscopic bodies.