The geth account new and web3.eth.accounts.create. That both function/command are same are different.To create new account.
The former is using the CLI while the latter is using the interactive interpreter shell, which calls the web3js wrapper which calls the RPC end point to create an account. They both do the same thing, but I would say the CLI has a greater degree of abstraction. It would be interesting to know if the CLI calls the web3js library or the endpoint directly