Electron and photon energy deposition in the Universe