By default s_client prints only the server’s own certificate. With -showcerts you get every certificate the server sends, intermediates included.
Save the whole chain to a file with awk:
echo | openssl s_client -connect example.com:443 -servername example.com -showcerts 2>/dev/null \
| awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/' > chain.pem
grep -c 'BEGIN CERTIFICATE' chain.pem
The count is the first thing I’d look at. A public site normally sends two or three. One certificate on a site that uses a public CA means the intermediate is missing, which is a common cause of errors on Android and in command line tools while desktop browsers still work.
In the normal output, the Certificate chain section lists each certificate with lines like 0 s:CN=example.com and i: for the issuer, so you can follow the chain without saving anything.
Keep -servername in the command. Without it, a server with several sites may send a default certificate that has nothing to do with the one you wanted. The echo in front closes the connection right after the handshake, otherwise s_client waits for you to type. The root certificate is normally not sent, so your file ends at the last intermediate.
Further reading: OpenSSL: openssl-s_client
Going deeper: Run degoog on Unraid as your own search page, compared with SearXNG and 4get