Welcome to Android Central!  Just to confirm -- you're talking about the Galaxy Tab S4, and not the old Tab4 tablet or the old S4 phone, right?
What does the dialog box say exactly?  Is anything physically blocking the proximity sensor, like a screen protector or a poorly-fitting case?