Hello Chris,
Thanks for your question.
Deployment slots, are isolated environments so your original code is fine.
Yes, deployment slots get unique host names.
See below Settings that are swapped and aren't ( from the official doc): https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots?tabs=azure-portal#manage-deployment-slots
You'd need to ensure DNS and routing mechanisms points to the correct hostname after a swap.
If above answer was helpful, please remember to "Accept Answer"