Minecraft has 2 ways to prevent unwanted players from joining the server. (This applies to both Java and Bedrock editions)
You can either use the whitelist feature which locks the server and prevents all players from joining except those who are on the whitelist. (Recommended for private servers such as family and friends)
Or
You can leave whitelist off which will allow anyone to join unless they are on the ban list.
To add/remove players from the Ban list, you can by either:
a) Using the "Ops and Whitelist" section of the server control panel settings and going into the "Banned" tab.
or
b) Using the "Console" section and typing the command:
Ban: ban <playername> [reason]
Unban: pardon <playername>
You should note that if your server.properties setting has online-mode set to false, both the whitelist and ban features are deemed unfunctional.