It’s a bit of an opinionated question because it’s essentially asking about appropriate orthographic representation of hierarchical constituents in romaji, the appropriateness of which depends entirely on what the writer is trying to achieve with their romanization. ように (or ようだ anyways) and 二度と have single entries in monolingual dictionaries, so to some degree they are considered single units. The question is to what degree are the に and と seen as separable parts of the words or not.
In general I think most people have the understanding that things like に and と are not inflecting parts of a base word, but rather are clitics (i.e., suffixes with syntactic function).
Standard romanization would be to include a space there, as you would before any particle, like “watashi ga”: “you ni” etc. Some people who want to represent the more tightly-binding clitic nature of the relationship may write “watashi-ga”, so you could do similarly and write “you-ni” or “nido-to”, however this tends to only be seen in linguistics papers (an = is also seen instead of -).
The completely joined forms of “youni” and “nidoto” IMO both are simply harder to read (because they look more like some sort of nouns) and also don’t really jive with the mental model most fluent speakers would have of the structure of those terms. It feels slightly more acceptable in the case of “nidoto”, because at least the と doesn’t tend to obviously morph as much as に/な/だ/で does.