All of this takes place on your Mac or iPhone, so Apple doesn't know anything about your browser activity. In addition to trackers, widgets on websites, such as share buttons or comment fields, can also track you, and Safari acts on these as well. But Safari does not block trackers; this could break websites.
Does Safari track your searches?
Safari keeps track of which websites you visit the most frequently. These appear when you open a new tab on your device, while handy it's not strictly necessary. You can disable this option by going to Settings, then Safari and then selecting the option to disable Frequently Visited websites.
How do I stop Safari from tracking me?
You can stop third-party content providers from tracking you across websites to advertise products and services. In the Safari app on your Mac, choose Safari > Preferences, then click Privacy. Select “Prevent cross-site tracking.”