Old tutorials say dig ANY example.com lists all records of a domain. These days it mostly does not, and the reason is written in the answer itself.
Ask a Cloudflare name server directly:
dig ANY cloudflare.com @ns3.cloudflare.com +noall +answer
The answer is a single odd record: cloudflare.com. 3600 IN HINFO "RFC8482" "". RFC 8482 lets name servers answer ANY with a small subset of records, or with this placeholder, because ANY was popular for amplification attacks. Public resolvers can go further: Cloudflare’s 1.1.1.1 answers with status NOTIMP and no records at all.
So I’d ask for the types you care about. dig takes several queries on one line:
dig +noall +answer example.com A example.com AAAA example.com MX example.com TXT example.com NS
There is no reliable way to list every record of a zone from the outside, and that is on purpose. If it is your own zone, export it from your DNS provider, or use AXFR on a server you run. Some servers still answer ANY in full, especially older setups, which is why the old tutorials seemed to work. Do not build a script on it.
Further reading: dig manual (BIND 9), RFC 8482: minimal ANY responses
Going deeper: Guide: dig for beginners, look up DNS records and read the answer