This is a sample script for highlighting the row and column of the selected cell using Google Apps Script. For this, the OnSelectionChange event trigger is used.
Demo
Sample script
Please copy and paste the following script to the script editor of Spreadsheet. And, please select a cell. By this, the script is run by the OnSelectionChange event trigger.
function onSelectionChange(e) {
const range = e.range;
const sheet = range.getSheet();
const maxRows = sheet.getMaxRows();
const maxColumns = sheet.getMaxColumns();
sheet.getRange(1, 1, maxRows, maxColumns).setBackground(null);
sheet.getRange(1, range.getColumn(), maxRows, 1).setBackground("yellow");
sheet.getRange(range.getRow(), 1, 1, maxColumns).setBackground("yellow");
}