Scenario Based explanation for IP addresses and stuff-

In your home there is router/modem provided by the ISP (Internet Service Provider)

This router will have a Global IP Address the devices which are connected to this modem will have their Local IP address.

How Modem Allocates IP Addresses to these connected devices?

If you make a request to Google.com the google will see the Global IP address and not your Local IP address, for google this is one single device which is making the request.

Once the Google sends back the response to router how does the router understand to whom the incoming response belongs?

Now the router knows will device made the request, but in this device which application made the request? Because the response must be sent to the application of the device, not just the device.

Using IP address we get the device and using PORT we get the Application to which the date must be sent.