You can get the current block number of bitcoin in two ways.
First Way:
you will need to install the complete bitcoin-core and its data(around 223GB) on your machine and you need to run that bitcoin-core software 24*7 so that it will update the data on your machine and will give you the current block height and its information.
You can download the full bitcoin-core through this link:
https://bitcoincore.org/en/download/
Once you download the bitcoin-core, go through the certain command which will help you develop and monitor bitcoin network.
You can find the commands here:
https://en.bitcoin.it/wiki/Running_Bitcoin#Command-line_arguments
Second Way:
You can directly scrap the data from the bitcoin explorer which gives us the up-to-date information of bitcoin-core networks such as all the transaction and its metadata.
some of the bitcoin explorers are:
1.https://www.blockchain.com/explorer
2.https://www.blocktrail.com/BTC