I, too, use the app called Backups. It’s a good idea to set this on a schedule. Restore from the same app.
You might optionally consider exporting your calendar entries, contacts, message content, emails, browser bookmarks, etc., just as an additional failsafe, although it might not be necessary.
You should reflash the OS before shipping, in order to protect your private data/logins, etc.
Alternatively, instead of file level backup, you can also take a full partition or disc image, which you can then (over)write to the disc when it gets back and have it in identical condition software wise. May be even a security issue, if someone has added something to the device along the way. Connect via jumpdrive and use Discs app for example, on another linux comp, to create the image.
Seconding this. There is no way I would do anything other than a disk image made using Jumpdrive (and I would then reflash with a factory image before shipping).
However this assumes that the warranty concerns are hardware concerns, not software or configuration concerns.
To some extent it makes sense to do as per the first paragraph anyway i.e. to demonstrate that whatever problems are occurring still occur with a factory image, thus ruling out any dodgy software that has been installed or any dodgy configuration changes that have been made i.e. to justify sending it back under warranty in the first place.