I wouldn’t do it. You’re more suseptible to infections right now, and your skin more prone to thinning and breaking. Add them together with friction, and you’re risking getting small fissures or cuts on your scalp which could them become infected. You don’t need to deal with that right now.
Shaving should be fine, though. I’d use an electric razor rather than a blade (again, to protect from nicks and cuts). The shorter hair will be easier to deal with as it falls out.