What is the difference between the terms "samsara" and "dukkha"?
What is the relationship between the two?
In my own words:
Samsara is the same world you see on TV and read about in newspapers. This world is a hallucination (a subjective reality) fabricated in dependence on the fundamental confusion caused by the fundamental ignorance. This confusion causes dukkha and dukkha causes further confusion, which is why Samsara is dubbed "cyclic existence" - but also because the confusion is passed on from previous lives to future lives.
Dukkha is the painful and bitter feeling of wrongness you experience while in Samsara, because of the mismatch between the hallucination and reality.
Saṃsāra is endless cyclic existence (Anamataggo bhikkawe samsaro pubbha kota na pannayati) caused by Avijja and Tanha (Avijja neevarananang thanha sanyojanag). Note that Avijja means ignorance about four noble truths including Dukkha.
Avijja Sutta -SN 45
Others have nicely explained the different meanings of the two terms. As for their relationship, I'd actually say that samsara and dukkha are the same thing from different perspectives -- samsara from a cosmological standpoint, dukkha from an individual (psychological) standpoint.
To be in samsara is to experience pervasive, self-reinforcing (cyclic) dukkha due to ignorance. To be in ignorance is to suffer and hence to be in samsara. So samsara => dukkha and dukkha => samsara, hence samsara <=> dukkha.
This is an elementary example of how cosmology and psychology (phenomenology, experience) mirror each other. Rupert Gethin treats this at some length in a great series of papers, though with more intricate concepts. Here it is summarized in the Wikipedia article on samsara. You can look up his papers on the subject, and he also treats it in chapter 5 of his text, The Foundations of Buddhism.
You could also add avidya (ignorance) as a third element of the equivalence, perhaps from the philosophical or conceptual perspective.
They are conjoined in the dispensation:
what is samsara is dukkha, cessation of dukkha is cessation of samara and dukkha is a characteristic of samsara.
What is water is liquid, cessation of liquid is cessation of water and liquid is a characteristic of water.
It would not be appropriate to use them as synonyms always as they are different abstractions.