Apple has released a mode called Night Shift for iPhones and iPads. What it does is it reduces blue light from your phone in the evening/night so that one can sleep better. Blue light is known to be unnatural since throughout human history (before Edison), humans have lived in darkness at night. Fire from candles/lantern is Red light, which is considered not as bad as Blue light.
For Mac, there is no such thing as Night Shift (yet), the best alternative is f.lux. I recommend the “classic f.lux” mode over the default, as the default is too extreme (overly red).
Other than improving sleep, another factor it can help with is eye strain.