An IP (version 4) address has the following problems if you are using it to track individual users:
Many users use an ISP that gives them a temporary DHCP-issued address which can change anytime.
Many users are behind a router that uses NAT to allow multiple users to appear to originate from the same IP address.
Some users may be using a proxy server to access your website due to a policy of their workplace, ISP, or government.
So, while a well-designed website will still do things like block on the IP level if abuse from a specific IP is detected, the website itself will use cookies to tell users apart.
If a server "sets" a cookie, what is supposed to happen afterward if the client "accepts" that cookie, is that the client sends those cookies back with each future HTTP request (in the HTTP headers).
So, all the server needs to do is "set" a single cookie that has a random value, and preferably is a nonce - a value that can only happen once. Then the client keeps sending it back and it can be used to identify the client.
So, this cookie will determine your session on the server (hence why it is called a session cookie) and will allow the website to connect incoming HTTP requests with a current login, determine if your login has timed out, etc.
An interesting yet not totally relevant thing: Some cross-site scripting attacks try to trick your browser into giving a different website such a session cookie and then using it to do things as if the attacker were logged in as you. A good website can mitigate this by invalidating the session cookie and maybe raising a security alert if it detects a sudden IP change.