Is a legal keylogger safe for monitoring my child's phone?

My teenager has been super secretive about their messages lately, so I am looking for ways to see what they are doing online to make sure they are safe. I have read that there are keystroke recorders meant specifically for parents to use, but I am nervous about potential privacy flaws with third-party software logging everything. Have any of you used these kinds of programs, and do they expose the phone to external hackers or cause other major security issues?

Keyloggers can pose security risks if they are not from a reputable source. They may expose data or introduce malware.