How do you block a user on Minecraft Bedrock Realms?
From Realms main menu, you should have a edit button next to the Realm (the pencil icon) that shows a menu with different options. What you are looking for is Members menu, which lists all the players invited. From there, you should be able to remove the access to those players you don't want on your realm.
From that menu you should also be able to define Members' permissions for players joining from invite, and simply set them as Visitor. In this way, players that gained access via shared link cannot interact with the world or any other player. This means that every other trusted user who received your shared link needs to be upgraded, at least, as a Member.
See this video for more information.
From different Reddits:
Where you click share link and you copy there should be a little refresh button that changes the link. I'm pretty sure this disables the previous one.
In the same place where it says “invite members” there’s a tab called “share link.” He needs to go to the share link tab and press the refresh button, it looks like an arrow in a loop. It will ask for confirmation to create a new link and invalidate the old one.
you can both regenerate the code to make the old one invalid as well as setting the realm to invite only
Also from Minecraft.net:
If it’s getting a bit crowded, you can cancel the old invite link so no one else can use it – just refresh the link from your Realms member settings. Only the newest version of your invite link will allow new players to join.
When you refresh an invite link, anyone who has previously joined will still be in the Realm whitelist and able to join the world, but no new players will be able to use that link to gain access.
This invalidates the old shared link. Players who gained access via old link are NOT automatically blocked, but you can always manually remove them from Members list, since they cannot join anymore.
Source here, here and here.