Apple's Messages app has a built-in safeguard to prevent links or phone numbers in unsolicited messages on iPhones from being ...
(Go to Settings > Messages [iOS 17 and earlier] or Settings > Apps > Messages [iOS 18] and under Text Message Forwarding ... to devices if you set up a new computer, phone, or tablet.