Because the tenses of sentences should be consistent, the simple past tense should be used here: "It didn't work"
But if you put it in a specific environment,
It may also be correct.
For example, the following conversation:
-Why not be nice to him?
We tried to be friendly at first, but it didn't work.
Here's the normal state: "This won't work."
In addition, if it appears in spoken English, tense is not so important, that is to say, the right or wrong grammar is not important.