How to make automatching system or random matching system

im currently planning to make a multiplayer mobile game, I am new to networking and stuff so don’t know much solutions. i wanted to implement a system like where imagine there are 2 players both of them click on play and one of them auto host a match and the other client automatically joins without having the IP of host or if not possible I want to make it like some person click on host and he hosts a match and someone from very far clicks on join and randomly join any match without any IP address thing. i want this without dedicated server can you please help.please