A Best-of-Both-Worlds Algorithm for Constrained MDPs with Long-Term Constraints