Back when I did some
OpenGL programming as a hobby, I was concerned with this very issue.
In the typical game, an artist draws a GUI element, and the programmer simply rasters the element to the screen at the element's native resolution (E.g. 256x256 pixels).
You'll see this in most game programming tutorials. The problem is just as described. The element is too big on smaller resolutions, such as low-res TVs and older monitors, but too small on new, higher-resolution monitors.
My solution was to draw GUI elements purely in GL calls. It takes a little longer, but it returns serious dividends, such as customizability, transparency, and shading that doesn't require the re-processing of pre-built image elements.
The HUD "crosshair", RPG stats bars for Strength, Agility, and Stamina on the right, and the real-time compass at the bottom center are all GL-created and don't rely on a pre-made image, such as the ammo-type or armor-type icons on the left. The crosshair changes depending on the weapon used.
As it is, utilizing existing elements, the game needs to take the graphic elements of the GUI and scale them or reposition them, depending on not only the resolution on each axis, but also the video ratio, which is typically closely associated with resolution.
Mobile app programming tends to address these concerns a little better than conventional game programming.
Some layout changes might involve moving the hotbar from the bottom to the side of the screen for outputs with very wide (most modern monitors) video ratio.
It all goes back to being able to scale individual elements. For example, instead of displaying a 256x256 element at native resolution, it needs to be scaled to 10% of the X resolution. On a 1920-pixel wide monitor, that element scales to 192 pixels wide. On a 4k-wide monitor, that same element scales to 400 pixels wide. Similarly, if someone were to go old-school, and set the resolution to 640x480, the element would scale down to a miniscule 64 pixels wide.
At one point, there was noise about the GUI being very customizable. It has made some strides in that regard, but obviously, there is still more to go.