I have both 3 and 4. Mostly play 4 these days but sometimes I still go back to 3. If I was forced to choose to only keep one of them... hmmm... it'd be a very tough choice, but I'd probably pick Sims 3.
For a beginner though, I'd probably recommend Sims 4.
If you have a tendency to be a completionist - that is the sort of person who will feel the need to get all the expansion packs if you get into a game - then I would definitely advise you to get Sims 4 and not 3. The Sims 3 with all the packs is tough on a computer! It'd probably be a laggy mess unless you have a good computer AND you take the time to follow some of the Sims 3 optimization tutorials that show you how to minimize the lag issues. Sims 4 is definitely not free of issues either but it has been deliberately designed to run on less powerful computers.
If you're not a completionist type of person... well, my previous computer couldn't handle Sims 3 with too many expansion packs and I still had hundreds of hours of fun with only the Sims 3 base game + Ambitions installed. The equivalent in Sims 4 (base game + Get to Work) did not hold many attention for nearly as long. In general, I think Sims 3 packs contain more content than Sims 4 packs. Eg. With The Sims 3, you can get the World Adventures expansion pack which contains three different vacation worlds for your sims to explore and have adventures. With Sims 4, you'd have to buy both the Outdoor Retreat and Jungle Adventure game packs just to get two different vacation worlds for your sims to explore. (Yes "game packs" are meant to be smaller than "expansion packs" but from a cost perspective World Adventures was just better value for money imo).
And if money is a consideration, Sims 3 will probably be cheaper particularly the packs. But on the other hand, Sims 4 is still getting updates and new packs. At least for now. (Probably until they eventually release Sims 5).
Hopefully this will help you decide what would be best for you.
Edited to add:
If you like building houses etc, Sims 4 build mode is a lot easier to use in my opinion, but Sims 3 build mode offers you more customisation options to get things looking how you want. The trade off is it's less intuitive overall and for some of the advanced stuff (like constrain floor elevation) you'll definitely need to watch a tutorial. But the plus side is you can do things that are impossible in Sims 4 build mode. So again, there's pros and cons to both