If your vehicle is showing a/c only blows cold when driving, not at idle, here are the most likely causes and the parts you'll need to fix each one.
Without ram air from driving, the A/C condenser relies entirely on the electric cooling fan to remove heat. If the fan motor is dead or the relay has failed, the A/C will blow warm at idle and the engine may run hot.
A slightly low refrigerant level reduces the system's cooling capacity. At higher engine speeds, the compressor spins faster and compensates to provide cooling, but at idle it cannot keep up.
On rear-wheel drive vehicles and trucks, a fluid-filled mechanical fan clutch pulls air through the condenser. If the clutch leaks fluid or wears out, the fan won't spin fast enough at idle to cool the A/C condenser.
Adding too much DIY refrigerant causes system pressures to spike. At idle, with less airflow over the condenser, the high-pressure safety switch shuts the compressor off to prevent catastrophic damage.
Leaves, bugs, or road debris can block airflow through the condenser fins. Highway speeds force enough air through to cool the system, but the idle airflow from the fans isn't strong enough to overcome the blockage.
Internal wear in the compressor reduces its ability to pump refrigerant efficiently. It may only build sufficient pressure when spun quickly at driving speeds, failing to compress enough gas at idle.