None of the both is a bad choice.
I would prefer Warlock, Pact of the Chain. I like the little flying devil minion mainly for scouting (can get invisible) and to reduce the threat from ranged enemies.
In my opinion Warlocks don't get that much from higher levels, so multiclassing with Sorcerer is a good option. You get more spell slots for utilities where lvl1 slots are enough, mainly Hex. Hunger of Hadar, a lvl 3 Warlock spell, is in my opinion the best combined area denial and damage effect in the game, only Sleet Storm is better in shutting enemies down, without having damage however. I missed Hunger of Hadar the most after I ended my Sorlock phase and went Sorcerer/Cleric.
When you go Ranger, you should rethink the choice of the Hunter subclass, in my opinion by far the weakest option. Ranger is capable of many things and can be fun, in combat and during the dialogues etc., but nothing is great. As archer a Fighter (or Fighter/Rogue) is a lot better (f.e. because Ranger cannot increase hit chances and does not generate comparable damage; Hunters Mark later loses, and you get the ability from Grym's helmet anyway), as melee he stinks against any other of the martial classes. In theory going twohanded heavy armor Beastmaster with GWM and the hog (an animal Barbarian), as means to make enemies prone (so you have always advantage), sounds good, in practice it sucks (f.e. because the hog has 0 initiative and never goes when needed). As Beastmaster you have at least a variety of options with your animals, but the animal companions aren't that good in the later game.
Gloomstalker may be the best Ranger subclass, if you want to go stealthy and maybe combine with Rogue or Fighter. I did not like the gameplay when I tried, but that's personal taste.
An argument for Ranger might be that no companion has this class (except Minsc whom you meet only in Act 3), so you can play Warlock anyway if you have Wyll in the group. If you are reluctant to change classes of companions, of course.