Hi oYjamesYo,
Thanks for coming to Apple Support Communities for help today.
Are you using Messages in iCloud? If so, then you won't be able to get the messages back if they were deleted. Once deleted, they will delete everywhere. You can check in Settings > [Your Name] > iCloud. This article also talks more about Messages and iCloud: Keep your messages up to date with iCloud.
If you aren't using this feature, you may be able to recover the messages from your last backup. Keep in mind, if you restore a backup, you will lose whatever has been saved to your device since that last backup. Here's how to Restore your iPhone, iPad, or iPod touch from a backup.
If you ever have a device that runs iOS 16 and any messages accidentally get deleted, then you will have time to recover them. This article explains more: Delete and recover messages on your iPhone or iPad.
Have a fantastic day!