WordPress User ID as Shortcode

From add_shortcode

…Note that the function called by the shortcode should never produce output of any kind. Shortcode functions should return the text that is to be used to replace the shortcode. Producing the output directly will lead to unexpected results…

Try changing the echos in your callback to returns and see, if that helps.

error code: 523