There aren't good ways to do this automatically for text, and state of the art is rapidly evolving.
https://arxiv.org/abs/2403.05750v1
For photographic images which contain detailed images humans or contain non-standard objects with details, there are still some reasonably good heuristics for when AIs will mess up those details, but I'm not sure how long they will be valid for.
Technical answers are likely to be obsolete in a few months when the next versions of AIs are published.
In the meanwhile, if a person you know calls you, ask them about some experience you had together that wasn't documented in writing.
A piece of text... maybe Ctrl+F "as a large language model"? :D
An image... count how many fingers on each hand, and how many hands on each person.
Almost nothing is real. Even non-ai text or images are often false or misleading. Almost everything is real, in that a human decided to cause it to happen.
What are the best ways to figure out if someone who contacted you / a piece of text / an image is AI generated?