Yes, you can use the same language for both making websites and coding their hidden parts. This method is called full-stack development. It lets developers make their jobs easier by using just one language all through the web application.
Common choices for full-stack development are JavaScript with Node.js and languages like Python and Java.