If you have different DNS names those functions can be on different servers using different technology. One could be in AWS, one in Azure, another on a mac in your office, another on a CDN, another could be some SAAS vendor operating under your brand.
The Cloudflare blog has a good explanation: https://blog.cloudflare.com/subdomains-vs-subdirectories-bes...