Java 26.2
/ride
@p@e[type=minecraft:horse,limit=1]/ride
Mount or dismount entities.
/ride @p mount @e[type=horse,limit=1]
Mount and dismount
Java can nest passengers inside a single /summon; Bedrock generally cannot and needs a staged ride command instead. Build the mount or dismount here, and use it when the passenger relationship has to be established after both entities exist.
/ride <rider> mount <vehicle> attaches the rider after both entities exist. This is the Bedrock-friendly way to build jockeys and mounts, since Bedrock cannot nest Passengers NBT inside a single /summon like Java can.
Use /ride when the two entities already exist, or when you are on Bedrock. On Java you can also nest passengers directly in /summon; /ride is for establishing the relationship afterwards.
/ride <entity> dismount detaches it from whatever it is riding. Pair mount and dismount to move a rider between vehicles.
Java 26.2
@p@e[type=minecraft:horse,limit=1]Mount or dismount entities.
/ride @p mount @e[type=horse,limit=1]