Yes, that shouldn't be a problem, as long as you make sure both application will have the necessary resources to run, and also that your server meets the Supported Platforms for each application.
The following documents show the list of Supported Platforms for the latest version of each application. I'm also linking below a document with some further ideas about the requirements when running Confluence.
Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across Jira Cloud instance. 📢 Get y...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events