The best way to prevent glare is to use anti glare glasses if you are a glasses wearer or non-prescription anti blue light lenses with anti glare if you don't use prescription glasses but do use digital devices regularly.
Other practical steps you can take are
Adjust your screen
If you are using a laptop or PC you can adjust the position of your screen to minimise glare. If the screen is facing an unshaded window or if the light from outside the window is shining directly on the screen then these are conditions where the user is highly likely to experience glare. Adjust your screen to alter the angle of the reflections away from your eyes. Most monitors allow adjustment of brightness so its best to align the screen brightness to the same level of brightness in the room as discrepancies here can also result in glare.
This is a great guide to improve your "visual hygiene"
The 20-20-20 rule states that you should try to take a break from screen use every 20 minutes and to look away from the screen and into the distance for 20 seconds and focus on an object 20 feet away.
Making a conscious effort to blink regularly is also very important when using screens. This is because when we are doing prolonged close concentrated our eyes converge and don't blink as much as they would if we were looking further in the distance and not doing concentrated work. Because we don't tend to blink as much in these situations our eyes dry out and become strained and uncomfortable. Making a conscious to blink helps rehydrate the eyes and keep the eyes refreshed.
Positioning of internal lights
The positioning of internal lights are an important factor to consider when looking to reduce glare from screens.
Artificial lights should be placed at right angles to the screen to avoid glare. The monitor can be altered for overhead lighting and desk lamps should be adjusted to create this angle also. Adjustable lights which can be dimmed and increased are also a good idea so that they can be adjusted to suit the conditions to keep glare to a minimum.
Make sure that your desk has a dull or matt finish rather than a shiny surface that will reflect light and cause glare. If possible its a good idea to alter the colours of the walls and surrounding areas to prevent glare.
Glare and Digital Eye Strain
Glare, along with blue light is a major cause of digital eye strain or computer vision syndrome. Glare from the computer screen causes the pupils to constrict and rapid eye movements which are highly correlative with glare discomfort. Repeated exposure to glare can cause a stress on the visual system causing eyestrain and tired eyes. Those with cataracts in their crystalline lens suffer even more from glare from computer screens because rather than doing through the lens unimpeded, light from the screen enters the lens and is reflected off the cataract causing more glare. When using digital devices using glasses with anti blue light lenses and anti glare lenses is a great idea to reduce digital eye strain and improve visual oomfort.