You either set the DNS settings per device to the system running PiHole / AdGuard Home, or if your router allows, set the DNS there. It’s ideal to set it on the router.
Any time a device makes a DNS request to a domain, it’s checked against the list. If found, it’s stopped. If not found, it gets sent upstream to your choice of a public DNS configured during setup. I use Cloudflare (1.1.1.1, 1.0.0.1).
Someone made a mistake here. It’s not getting your IP address. An IP address is assigned by the gateway when you’re connected to an access point. An IP address is not an identity. They are always changing and can be shared. This has already been tested and upheld in court.
It’s actually collecting your MAC address. Which is exchanged when your phone or tablet scan nearby WiFi points or Bluetooth devices. However, this can already be defeated. By default iOS and Android both have the option to randomise the MAC address in intervals. Making it extremely difficult to prove anything. This feature exists because the devices real MAC address never changes. It is unique. Alternatively, users can disable WiFi and Bluetooth scanning entirely. However, your device no longer participates in the Find My Devices program by Apple and Google, location does take longer to acquire in some scenarios, and accuracy may take longer to triangulate.