A surge protector shields devices from voltage spikes, while a UPS provides backup power during outages.