اعْمَلُوا مَا شِئْتُمْ / فَأْتُوا بِسُورَةٍ مِنْ مِثْلِهِ
Do whatever you wish; produce a comparable sūrah.
Both examples contain directive grammar. The first most naturally works as tahdīd (threat), whereas the second functions as taʿjīz (challenging the hearer to demonstrate inability).
The decisive question is what the speaker intends the audience to grasp: a fearful consequence of wrongdoing, or an inability to meet a proposed standard. Identical grammar does not imply identical rhetoric.
FeatureThreatDemonstration of inability
ExampleIʿmalū mā shiʾtumFaʾtū bi-sūratin min mithlihi
GoalFear of consequencesExposure of inability
ContextDefiance and accountabilityChallenge and attempted opposition