It's most likely not a bug, but a feature of adaptive brightness technology. Modern iPhones use pulse-width modulation (PWM) for brightness - the screen flickers at a very high frequency to reduce power consumption at low brightness levels. Most people don't notice it, but some eyes are more sensitive to this flickering. You can check easily: film the flickering screen with another phone's camera - if you see waves in the video, it's PWM.
First thing I'd suggest trying is turning off "True Tone" in Display & Brightness settings. This feature sometimes amplifies the flickering effect. Also enable "Reduce White Point" in the same menu - it might help when working in the dark. If that doesn't work, try updating iOS to the latest version; sometimes Apple releases patches that improve the brightness control algorithm.
If nothing helps, it's probably the display itself. With this kind of issue, you should contact Apple Service - they'll check whether it's a defective matrix. Under warranty, they usually fix or replace the device. While you wait - just try not to set brightness below 20% or use Low Power Mode; apps handle the backlight differently there.