A visa is a stamp or sticker issued in your passport that is exclusively used to gain admission into the United States. When someone intends to visit the United States temporarily (whether for a few weeks as a tourist or for several years as an H-1B worker), he or she must acquire a visa. Just imagine the Visa is like a key to enter the vacation house. A visa is only an entry document and can expire while you are in the U.S.
In short, your Immigration Status defines the purpose of the visit and the length of the stay. The categories are segregated by certain letters and each category serves different purpose. (e.g. F-1 for international students, H-1B for specialty occupations, etc.) A stamp is placed in the individual’s passport at the time of admittance. The stamp will provide the traveler’s arrival date, immigration status, and the status’s expiration date. For F-1 or J-1 student, the expiration will be shown as D/S. D/S stands for Duration of Status. The period of status is determined by the form I-20 or DS-2019. The person’s status terminates when that document expires. The granted immigration status will stay valid until the expiration date, assuming that the visitor obeys the regulations pertaining to that status. In most cases, maintaining a valid immigration status is more important than having a valid visa. Just imagine the Status is like the reserved ownership of the vacation house.
A visa is only an entrance document that can expire while you are in the U.S. If your visa expires while you are legally present in the United States, there is no problem. (Just like your key stopped working after you getting in the room. You can still stay in the room without any issue) Even though your visa has expired, you can stay in the United States as long as your status is still valid, and you continue to follow all immigration regulations. When the visa expires, the status does not terminate.
Your H-1B visa stamp expired on 12-01-2019. However, you filed an H-1B extension in June 2019 and had it approved. Now your H-1B status has been extended to 10-01-2023. In this case, your Visa expiration date is 12-01-2019 whereas your immigration status expiration date is 10-01-2023. You can legally stay in the U.S. until 10-01-2023 as long as you have fulfilled all requirements as a H-1B visa holder.