There is special guidance, so usually you can just do the level you “ought” to be in.
If it’s really severe there is special education as a last resort.
More commonly modified lesson plans, or teachers will be instructed to let you out of the classroom for a bit, or give you tasks like “fetch this item from the front desk” in between.
It’s certainly not perfect, but there is quite some guidance and individual measures possible.