Are you referring to the case of a police investigation?
No, this is not illegal. In fact, it is a tactic commonly utilized by officers to catch child predators, especially in the last decade or so with the growing rates of social media, internet chat rooms, etc.
If you're referring to an incident that does not involve the police, but only private citizens, impersonation only becomes illegal when impersonating a real person, not a fictitious one, but this becomes a bit of a trickier situation.
If you suspect that there is foul play, you should instead look in to filing a report with local police so that they can investigate and takes the steps necessary to execute an arrest.
I hope that helps!
Please let me know if you have any other questions. Also, please take a moment to rate me using the stars at the top of the page, as it's the only way experts are compensated for our time on the site. I do not receive a salary here at JustAnswer, and am only compensated for my time after receiving a rating of 3 stars or more (5 stars are always appreciated). The question won't close after rating, so you can still ask follow-up questions after. Thanks, ***** ***** it!