Those devices likely have Activation Lock / Find My set on them which requires the Apple ID and password used to place the lock.
Read this article to learn how to remove Activation Lock either on the device itself or on the web --> How to remove Activation Lock - Apple Support
or this one for disabling Find My if activation lock has not yet engaged --> Turn off Find My on your iPhone or other devices - Apple Support
If the person still has the receipt from Apple, Apple can completely reset a device if a person can provide sufficient evidence of valid ownership. This is done online* at: Activation Lock support request - https://al-support.apple.com/#/additional-support Apple says, "Proof of ownership documentation is required," but does not provide many details in the article as to what is acceptable proof. Prior to this official service Apple typically required the original receipt** issued by Apple or an Apple Authorized Reseller and documented provenance (so typically it would be the first owner who does this, or a descendant with legal proof of ownership transfer). Note that while this will let you get use of the device again, it will not help you with lost access to an account.
* There is a special link for this service. To save time you should use it instead of https://getsupport.apple.com/
**Apple recommends you keep your receipt after you buy an Apple device. --> Keep your receipt after you buy an Apple device - Apple Support
Rather than a hammer:
From the very bottom of Apple Trade In - Apple :
"Does Apple offer recycling?
Yes. Apple Trade In lets you recycle any Apple device (including devices from Apple-owned brands) at any Apple Store and on Apple for free. That includes your batteries and old electronic products as well as free, on-demand packaging recycling for our commercial, education, and institutional customers. When we receive your device, it will be thoroughly inspected to determine if components can be recycled or reused. Whether recycled or reused, all activities relating to the processing of your device will be managed in an environmentally responsible way."