It appears that you are using iCloud for Messages on your iPhone and on your iPad. This means that if you delete messages on your iPhone or on your iPad, then the messages will be deleted from all devices that are logged in to iCloud with the same Apple ID. The answer to your question is a YES. The messages will be deleted from iCloud and from your iPhone.
To prevent that from happening, do the following:
On your iPad, open Settings ➡️ Apple ID (Your Name at Top) ➡️ ICloud ➡️ Messages: Set this switch to OFF. This will prevent the iPad from Synching with iCloud. Once that is completed, then you can delete the messages from your iPad and it will not affect your iPhone.
Axel F.