This check is by no means a certainty that your phone hasn't been hacked, as there are many stealthy and sophisticated methods used / developed by groups and organizations that have both some of the best hackers, vulnerability finders, the most advanced programs / software / hardware, and big budgets to play with.
So some methods are harder to detect, and some are more than likely running right now on Smartphones or other devices of people deemed to be targets of interest but are so new and undetectable that no one even knows they exist yet other than the makers themselves and a few select people involved in the operation / project.
Pegasus
Take Pegasus for example, the spyware that was made by the Israeli cyber-arms company NSO Group. That was successfully installed on many devices before it became known about. From journalists and actors to business men and politicians, Pegasus has hacked many devices and obtained information on Government officials and detractors alike. Even Jeff Bezos [founder of Amazon] was a victim.
Watch Out
Pegasus is still used today, although there are known methods out there on the Internet that can be used to detect its installation. One being WhatsApp, in which the NSO group was actually sued by WhatsApp's chief Will Cathcart for hacking the platform to gain backdoor access to users smartphones.
Pegasus has been bought by Governments and agencies, including America's own FBI. Although the FBI claim to have not used it. For something that apparently cost them nine million dollars to buy, it seems like an expensive purchase for it to just sit there and never be used.
Quick Check
Moving on. With all that said above, this little check is still worth performing. It works on most mobile phones, both "dumb" and "smart" and works with the two most popular operating systems, Android and Apple iOS.
Performing The Check
From your phones main screen type *#21# [that's star, hash 2, 1, hash] and press call. After a few seconds a screen should pop up showing if any of your supposedly private information, such as SMS, voice calls, Sync, Data etc on your phone is being forwarded to anywhere else. The result you want is for all of them to read Not Forwarded.
There may be false, or true read outs of Forwarded if you yourself have set up a forwarder on any of the communications on the list. Forwarding your voice calls for example, so be aware of that.
Just for the fun of it, I would be interested to see the results of this check when Pegasus is known to be installed on a device. I would imagine all results would read Not Forwarded.