I recommend you discuss this question with your primary care doctor
or with your eye doctor
. Rubbing the eyes is a very common behavior, usually triggered by a sensation of fatigue or dryness or itchiness. Most of the time, this is a benign behavior, and it is very unlikely to cause any damage to the eyes themselves. One injury that can occur is scratching of the cornea, especially if they eyes are partially open when rubbed. A scratch on the cornea leads to a painful, burning sensation, often with increased tear production and blurring of the vision temporarily.
If you are noticing any persistent eye symptoms, such as those described above, or flashing lights, pain with moving they eyes, or double vision
these might be signs of a more serious eye problem and you should immediately seek assistance from an eye doctor.
Also, if you find yourself constantly rubbing your eyes, you should seek an evaluation (either from your primary care doctor or your eye doctor), as there may be a condition provoking the urge to rub your eyes - such as shortsightedness leading to eye fatigue, or eye allergies leading to dryness or itching. These are all conditions that can be corrected, and your doctor will be able to diagnose them and give you advice on what to do.