I was thinking of buying a used macbook or macbook pro and plan to replace the battery and HDD
As far as I am aware you can replace the battery and HDD/SSD on most MacBook Pro models. Have a look at the manuals on iFixit.
- I think the last HDD MacBook Pro. No retina display, but you can replace the optical drive and use a 2nd HDD/SSD instead.
Current-production MBP and MBA (Air) laptops have replaceable batteries and storage.
If you really mean "user-replaceable" then we have to go back to the MacBook (no pro) models of 2008. It's pretty easy to identify - flip it over, if there is a very obvious latch (aluminum) or coin-slot release (plastic) then you can change the battery in 30 seconds with no tools and the drive in 5 minutes with a common screwdriver.
Newer models have the battery completely inside the case. You will need 2-3 different types of screwdrivers, some rather specific (but quite cheap) electronics tools and about 30 minutes to swap out the battery and/or storage. Longer if that model has the battery glued to the case.
The 2015 Macbook (the super-thin one) does not have user-replaceable anything. The battery is glued to the case, and the storage is soldered to the logic card (it's too small to be called a "board") so you are stuck with whatever you ordered. But unlikely it will need anything for 5+ years.