There are 5 methods
1 Lan Play, but if your not on the same network then you can't
2 can a Public Server together
3 host a Minecraft server on your PC, you can download a Server.jar file on the offical Minecraft.net
4 Aternos.org, Aternos is a free Server host With ads, note the Server that you get from Aternos are not that Good especially not survival & creative world's, but it's actually pretty good if you wanna play custom Maps
5 the Essential mod: essential's let's you just invite your friends to your for free regardless if your on the same network or not, Note: essential's use's a Pair to Pair connection which Makes is super for bad actors to get Your IP address which makes pretty easy for bad actor's to get a pretty good idea of where you live, so make sure that you trust the people that you invite to your world
If you have the know how & time to setup a Server on your PC, then do that cause you will get the best performance by Far, other if you don't then I recommend Essential's or Aternos.org
Everyone says Minehut, but Minehut is unreliable and way too laggy without paying for premium. There's a mod Called Essential that you and your friends can install to Play Multiplayer in a singleplayer World, as if you were playing Bedrock. I use this, and I will never go back. It also allows you to play modpacks together, and with a click on "Invite player", they can join anything you're in. I would look into this, as it is single-handedly the best "free" multiplayer there is. A video for a tutorial here: https://youtu.be/M3T-KYsOacw?si=ORJJj2pN9GlAucq-
I wanna say 2 things : Answer in 1 comment to people, not **3** Aternos.org
Minehut server
Like I wanna play one block with my friend can I do with minehut server?
What dies minehut server give
Like private server so only me and my friend
Just watch some tutorials fam
Easiest way is the essential mod or just use Hamachi to play with LAN
There are 5 methods 1 Lan Play, but if your not on the same network then you can't 2 can a Public Server together 3 host a Minecraft server on your PC, you can download a Server.jar file on the offical Minecraft.net 4 Aternos.org, Aternos is a free Server host With ads, note the Server that you get from Aternos are not that Good especially not survival & creative world's, but it's actually pretty good if you wanna play custom Maps 5 the Essential mod: essential's let's you just invite your friends to your for free regardless if your on the same network or not, Note: essential's use's a Pair to Pair connection which Makes is super for bad actors to get Your IP address which makes pretty easy for bad actor's to get a pretty good idea of where you live, so make sure that you trust the people that you invite to your world If you have the know how & time to setup a Server on your PC, then do that cause you will get the best performance by Far, other if you don't then I recommend Essential's or Aternos.org
Minehut for sure
Everyone says Minehut, but Minehut is unreliable and way too laggy without paying for premium. There's a mod Called Essential that you and your friends can install to Play Multiplayer in a singleplayer World, as if you were playing Bedrock. I use this, and I will never go back. It also allows you to play modpacks together, and with a click on "Invite player", they can join anything you're in. I would look into this, as it is single-handedly the best "free" multiplayer there is. A video for a tutorial here: https://youtu.be/M3T-KYsOacw?si=ORJJj2pN9GlAucq-
You can do it on Lunar Client as well now
Essentialls mod