Based on your description we have to assume you install plenty of applications on your device. Its not uncommon for "free" games to show you adds while you play, it is how the game developers make thier money on the game. but for the phone to take you to a google page while texting would imply there is possibly a very aggressive app that can do that kind of thing installed on your phone.
You can manulally review the permissions each app has on your phone by following the steps below - NOTE removing an apps ability to do anything will likely break its function, like stopping google maps from accessing location data, so make sure you understand what an app is meant to be doing before you start changing permissions.
Common sense is key here, if you have an app that is for example a calculator app, it probably doesnt need rights to see your contacts and control call settings.
- Open Settings and choose Apps & notifications.
- Find and select the app you want to check permissions for.
- Tap Permissions.
- Now you can see all the app's permissions. To change a specific permission, tap it.
- Here you can delete any permissions you aren't comfortable with.
This or just factory resetting your device and slowly re-installing the apps you use until the behaviour resurfaces, then unisntall that app forever.
Adds are gross.