There may be multiple reasons why an entity is inactive. Most of the states will not allow you to use the entity name if the inactive company is still a part of the state records. If the business lost its active status due to having been forfeited for failure to obtain a registered agent. Or it may be voided for non-payment of the taxes. The state will want to give them some time to revive their entity. In such cases, you will not be able to use the same entity name for another company.
If an LLC is cancelled, or a corporation is dissolved – then you should be able to use their name.
The best advice here would be to simply ask the state first and their approval.