Minecraft comes in two editions. They can't play together out of the box, but you can connect them with a plugin.

Java EditionBedrock Edition
DevicesWindows, Mac, LinuxPhones, tablets, Xbox, PlayStation, Switch, Windows ("Minecraft for Windows")
Server softwarePaper, Fabric, Forge and othersBedrock Dedicated Server
Plugins and modsHuge choiceAdd-ons only, a much smaller selection
Default port25565 (TCP)19132 (UDP)

How to tell which edition someone has. If they play on a phone or console, it's Bedrock. On a PC, the title screen says "Minecraft: Java Edition" for Java. Bedrock on PC just says "Minecraft" and uses the Microsoft Store or Xbox app.

Can Bedrock players join a Java server? Yes, with Geyser and Floodgate. Geyser translates between the two editions, and Floodgate lets Bedrock players join without owning Java Edition. See "How do I let Bedrock players join with Geyser and Floodgate?"

Things to know about crossplay