You're not alone. There are many posts about 24"
iMac displays exhibiting problems:
The following topics illustrate the Silicon iMac Display problem:
Screen Failure on 24-inch-iMac, M1, 2021 - Apple Community
Horizontal Lines on Screen of iMac, 24", 2021
Horizontal black lines covering bottom 3rd of 2021 M1 iMac screen
Grey horizontal patches on my M1 iMac 2021 model
It's a hardware issue so there's no solution but to get the display replaced which, as of now, is only free is you still have Apple Care active for the iMac.
Some have quoted repair prices of around $600 US. If that is out of your budget range you might consider getting a 3rd party monitor and use it. Then if there's a recall/repair program you can get your screen repaired and end up with two screens.
Just some food for thought.