Processes in Microsoft 365 for setting up Office apps, redeeming product keys, and activating licenses.
Considering that Outlook is working correctly but Word and Excel are experiencing sign-in issues, could you please visit https://account.microsoft.com/services and confirm that your Microsoft 365 subscription is active? Additionally, try signing in at https://microsoft365.com using your browser and temporarily connect your Mac to a different network, such as a mobile hotspot, to rule out connectivity or authentication issues.
If you can successfully access your subscription through the browser but cannot sign in through Word or Excel, I would recommend using Microsoft's Office License Removal Tool to clear the existing licensing information and reactivate Office. You can find the official instructions here:
Could you also provide your exact macOS version, Office version and a screenshot of the error message so I can assist you further?