Hello,
Thank you for your question.
In my experience
You can use M365 Apps on RDS\Terminal service environment, Just ensure that Users gets Licensed in RDS evnriment.
Use Registry Editor to add a String value (Reg_SZ) of SharedComputerLicensing with a setting of 1 under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\Configuration.
Please have a look on below Microsoft article for Office 365 Apps RDS Licensing.
https://learn.microsoft.com/en-us/deployoffice/overview-shared-computer-activation
If the reply was helpful, please don’t forget to upvote or accept as answer.