Minecraft wiki entry for setworldspawn, associated text: Specifies the coordinates of the world spawn. If not specified, defaults to the block position of the command's execution. In Bedrock Edition, x and z that are greater than 30,000,000 or less than -30,000,000 revert to 30,000,000 and -30,000,000 respectively. y values which are greater than 256 and less than 0 revert to 256 and 0 respectively.
In Java Edition, it must be a block position composed of <x>, <y> and <z>, each of which must be an integer or a tilde and caret notation.
In Bedrock Edition, must be a three-dimensional coordinates with floating-point number elements. Accepts tilde and caret notations.