Depends on what you mean by "learning" different openings and endgames.
Memorizing sequences of moves is usually useless unless you understand WHY those moves are being played, and which alternative possible moves might be good or bad.
Increasing your understanding is one of the main ways to improve your chess game. Improving your alertness and situational awareness is another.
does learning different kinds of openings/ end games make you better at chess or is it just about how well you evaluate the position in the moment?
(i've never played chess seriously in my life, it's always been a hobby and i take pleasure in defeating people around me as they're way less skilled than people online or in tournaments. but i've gotten back in the habit of playing chess and feel like improving my game, thats the context)