99% of the time routers on the internet are only looking at the destination IP address when routing packets over the internet. They first inspect the packets destination IP address and then perform a lookup in their routing table, they are looking for the most specific route that matches that IP address.
Routes are considered more specific if they have a longer network mask, in this example consider the router has these two routes within the local routing table.
192.168.1.0/24 (255.255.255.0) via 10.0.0.1
192.168.1.1/32 (255.255.255.255) via 18.104.22.168
If we received a packet with a destination address of 192.168.1.1 we would use the more specific route (192.168.1.1/32), this is more specific because of the net-mask been the maximum length 32 bits long. Therefore the packet would be routed out of our interface providing connectivity to the next hop 22.214.171.124.
Where as a packet destined for 192.168.1.33 would use it's most specific route 192.168.1.0/24, this isn't the best possible route for that subnet, just the best route we have at the moment. This packet would be routed out of the interface providing connectivity to the next hop address of 10.0.0.1
Finally it's worth noting that routing tables are generally built on the internet using a dynamic routing protocol called BGP, this will go through a long process of determining the 'best' route to install within the routing table, even before packets start to route.