If you want to change the run time port then got the project setting, In the configuration, tab click on Application URL (‘http://localhost:8080/’) and change the runtime port number and click OK.
If you found my answer helpful please mark it as accepted, it would be great for me...
Allow me to refer to the documentation: https://docs.mendix.com/refguide/configuration
In the ‘Server’ tab you should be able to choose your port. This should do the trick.
Hope this helps!