Normally, Bitcoin Core does not keep track of data on non-wallet transactions, but this can be enabled with the -txindex option. Note that to create the transaction index for the first time, you will also need to reindex the complete blockchain with -reindex, which will take several hours to several days and a lot of extra disk space. When this option is enabled, you can use getrawtransaction with a past transaction, with or without a wallet. If you want a human-readable output, including the number of confirmations, add true after the txid. Fortunately, there are also turnkey solutions, such as various Blockchain explorers. Today, we have a plethora of blockchain explorers that can be used to extract all sorts of data from multiple blockchains, including hidden messages, block heights, and rich lists.