I've been noticing with my organization's M1 MBAir (2020) running macOS 14.x Sonoma that the screen dims a lot even if I bring the brightness to 100%. I don't if the same thing occurs with the older 2017 model running Monterey since we just got rid of that model. On the M1 Airs I believe the issue is related to the light sensor dimming the display (sometimes to 50%) if it is not in direct bright lights. I have not investigated the issue further since my organization's Macs are managed so that could be part of the issue...or a setting which I would be unable to change. I have found if I cover the camera and let the display dim, then while the camera is still covered I raise the screen brightness that the brightness level tends to stay where I've set it...at least better anyway.
Make sure to uncheck the setting for "Dim the display when on battery" found in the System Settings/Preferences usually under "Battery", but could be elsewhere with some versions of macOS since Apple moved these options around between macOS 10.15 and 13.x.
With the older model you can try an SMC Reset and PRAM Reset (hold the PRAM Reset for at least three chimes if possible).