Third-party cables, especially cheaper ones, often have higher electrical resistance than certified cables. This means they're not transferring power as efficiently, so more energy gets wasted as heat instead of going into the battery. Your phone heats up because it's working harder to pull the same amount of charge through a less efficient connection. The official Apple cable is engineered to minimize this resistance, which is why you're not seeing the same warmth.
Over time, regular exposure to excess heat during charging can degrade your battery's health faster than normal charging would. Lithium batteries don't like sustained heat, and if you're doing this daily with a subpar cable, you'll probably notice your battery capacity dropping noticeably within a year or two. It's not like it'll suddenly catch fire or anything, but you're definitely putting unnecessary stress on the battery.
The safest move is to switch to either an official Apple cable or at least a certified third-party option (look for MFi certification). If you want to keep using cheap cables, at least check if they're causing the same heat issue first. Also, avoid charging in hot environments when possible - your phone's internal temperature management only does so much. If the heat is extreme even with a proper cable, that's worth investigating further, but in most cases a better cable will solve your problem.