For iPhone, you would need to reset the whole thing because Apple does not keep your unlock code because everything will fall into the hands of the thief if they crack it. The iPhone is encrypted while locked so you can not transfer anything while locked.
If the device has Touch ID, I think this would be the only chance to unlock it by trying every finger the owner added for it.
I would also recommend just leaving it connected to a WiFi connection while plugged in a charger to sync with iCloud. Leave it for a day before you decide to reset everything. Hopefully everything will be recovered when you have sync'ed your iPhone with iCloud after the reset.
Hope this answered your question, if it did, please mark as the correct answer for the next viewer. Thanks! :)