Can my 2 1/2 year old use miralax (polyethylene glycol) longterm? We believe constipation stems from daily diphenhydramine

Yes. Since it is basically a wetting agent and not a true laxative, its actions are benign. I have used it in a monitored setting for a year with no problems, though most will respond to a good bowel rehab program in 6 months or less. .
Yes. Miralax (polyethylene glycol) is not a laxative as the name suggests. It is a non digestible sugar that pulls extra water into the intestine to soften the stool. It can be stopped cold turkey or weaned gradually whenever no longer needed.
If specialist agrees. For chronic constipation in a 2 or 3 year old, some sort of laxative is usually used. Long-term use of any medication in young children is done only if there is not a good alternative. A pediatric gastro-enterologist (specialist for intestinal issues) can evaluate and help decide on the treatment course, especially if a child can't be successfully weaned off a medication in two months.