The IANA TLD list should never be used directly. What you really want instead is the Public Suffix List [1]. It will help you determine the "effective TLD" of domains like amazon.co.uk or sflawlib.ci.sf.ca.us, and gives you more insight in to how a technical allocation at the root transforms politically in to implementation.

1. https://publicsuffix.org/list/public_suffix_list.dat

PSL maintainer here: please don’t use the PSL!

Yes, it’s weird to have a maintainer asking people not to use their project, but the PSL was a very specific (and unfortunate) hack for a very specific (and unfortunate, and browser-created) problem. It is something we live with, not something we like. While the ideal world is “don’t use any list at all, use the protocols as God, the IETF, and IANA intended”, if you are going to use a list, using the IANA list, updated daily, is much better than the PSL.

Do not use the PSL for anything that is not “cookies abusing the Host header”

https://github.com/sleevi/psl-problems