No, Terraria does not support cross-play between Xbox and PlayStation at this time.
Cross-platform play is limited mostly to mobile and PC players depending on version.
There have been discussions about expanding cross-play, but nothing official yet.
Each console version gets updates at slightly different times which complicates syncing.
If you're looking to play with friends, it's best to all be on the same platform.