When using local IP addresses from the 127.X.X.X range, you can be sure that no one from the outside can access the server. If, on the contrary, you want to demonstrate the result of your application, you can specify the IP address as 0.0.0.0 as the host:
php -s 0.0.0.0:4000
In this case, you can access the Web server by accessing the IP address of the host where the server is running, for example
http://192.168.0.1:4000. In order to be able to contact the host by a pseudonym, you either have to register it in the hosts file of each computer from which you are accessing the server, or register a domain name and associate it with the IP address of the computer where the server is running. Of course, in this case, when running, you will need to specify this domain name as a host.
php -S example.com:80
However, the built-in server is intended only for development, to ensure the operation of a full-fledged site, it is better to use industrial servers, such as Apache or nginx.